You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP client: Support passing default request headers #449
$browser = newReact\Http\Browser();
$browser = $browser->withProtocolVersion('1.1'); // already supported$browser = $browser->withHeader('User-Agent', 'ACME'); // could be useful?$browser->get($url)->then(…);
This isn't currently supported, but seems reasonable and would also allow other packages to take advantage of custom HTTP request headers. What do you think about this?
👋 Unsetting a default header, would that happen through […]
$browser = $browser->withoutHeader('User-Agent')
@bartvanhoutte The idea is definitely to keep this in line with our existing interfaces. In particular, PSR-7 (HTTP messages) already define a withoutHeader() method, so I would absolutely go for this as well here 👍
Reacted by Bart Vanhoutte, Cees-Jan Kiewiet and Carlo Revelli
Activity
WyriHaximus commentedon Apr 11, 2022
Seeing this pattern in my own projects where I do this for the
Authorizationheader. So lets add this 👍bartvanhoutte commentedon May 24, 2022
👋 Unsetting a default header, would that happen through
or
What do you think?
clue commentedon May 24, 2022
@bartvanhoutte The idea is definitely to keep this in line with our existing interfaces. In particular, PSR-7 (HTTP messages) already define a
withoutHeader()method, so I would absolutely go for this as well here 👍clue commentedon Sep 15, 2022
Closed via #461