Skip to content
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

[9.x] Fix: prevent duplicated content-type on HTTP client #45960

Merged

Conversation

danilopolani
Copy link
Contributor

The PR fixes a weird behaviour where calling multiple times a method that sets a content type (or manually) will append the same content type duplicated, eventually causing issues with external APIs (especially with Express middlewares etc.).

Sample to reproduce the old behaviour:

use Illuminate\Support\Facades\Http;

$client = Illuminate\Support\Facades\Http::asJson();

$client->asJson();
$client->asJson();
dd($client->getOptions()['headers']['Content-Type']);

Output

image

@taylorotwell taylorotwell merged commit 490713a into laravel:9.x Feb 4, 2023
@danilopolani danilopolani deleted the fix/http-client-duplicated-content-type branch February 4, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants