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

[8.x] Fix Http::withBody() not being sent #37057

Merged
merged 2 commits into from Apr 20, 2021

Conversation

deleugpn
Copy link
Contributor

I'm currently building an Outgoing Webhook feature where users can select which HTTP Method they want to call and which URL. At some point in code, I have the following snippet:

        $response = Http::withHeaders($headers)
            ->withBody($body, 'application/json')
            ->send($webhook->method, $webhook->url);

However, this doesn't work because it doesn't match any condition in the send method, which then sends a request with an empty request body.

This pull request sends the pending body automatically if there is no instruction in $options on how to construct the request body.

@taylorotwell taylorotwell merged commit 57c283c into laravel:8.x Apr 20, 2021
@deleugpn deleugpn deleted the http-with-body branch April 20, 2021 12:53
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.

None yet

2 participants