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

Guzzle sends request without body #2

Open
toh82 opened this issue Feb 21, 2023 · 1 comment
Open

Guzzle sends request without body #2

toh82 opened this issue Feb 21, 2023 · 1 comment

Comments

@toh82
Copy link

toh82 commented Feb 21, 2023

It seems this is a bit outdated:

            $request = $client->request(
                Request::HTTP_METHOD_POST,
                self::API_REQUEST_ENDPOINT,
                [
                    'json' => $params
                ]
            );

if I run this, the body for the request within \GuzzleHttp\Client::requestAsync is always empty because it can't find $options['body'] also there it tries to set the headers which are empty, too $headers = $options['headers'] ?? [];

Besides this, currently the request to Melissa, even if the above is adjusted, returns GE08 (my API Key is actually allowed to do the request, we checked the config) so I wonder if the request has an additional problem somewhere.

I adjusted the code above like this, dunno is it's completely correct

            $request = $client->request(
                Request::HTTP_METHOD_POST,
                self::API_REQUEST_ENDPOINT,
                [
                    'headers' => [
                        'Accept' => 'application/json'
                    ],
                    'body' => json_encode($params)
                ]
            );
@toh82
Copy link
Author

toh82 commented Feb 21, 2023

I allowed me to create a pull request for this
#3

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

No branches or pull requests

1 participant