-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override request header in Http Client #47313
Comments
@DJafari is this resolved if you use arrays? request = Http::withHeaders([
'X' => ['AAA']
]);
$request->withHeaders([
'X' => ['BBB']
]);
dd($request->getOptions()); |
@joelbutcher No, for me the output is still the same. |
Going to close this, as this is a feature request rather than a bug. Both the first and second values for a header are passed, which the spec supports. The consuming client would need to decide how to handle things. The following app: Route::get('/', function () {
return Http::withHeaders([
'X-Foo' => 'first',
])->withHeaders([
'X-Foo' => 'second',
])->get(url('/dump-headers'))->body();
});
Route::get('/dump-headers', fn () => request()->headers); Correctly merges and sends both headers. This is the browser output from that application.
|
Edited: incorrect. |
PendingRequest doesn't have so if sending array values is valid, telescope only log first value and and it has bug i think it's bug, if someone want sending array value, he will pass in an array from the very beginning, it's mean only if we pass header with this syntax : Http::withHeaders([
'X' => ['AAA']
])->withHeaders([
'X' => ['BBB']
]); this result is correct :
|
See also laravel/telescope#1355 |
@timacdonald thanks! |
Laravel Version
10.12.0
PHP Version
8.2.6
Database Driver & Version
No response
Description
in some case if i want change request header, caused dupplicated and only first value passed
check reproduced code and result
Steps To Reproduce
Result :
The text was updated successfully, but these errors were encountered: