In Laravel, using Http Client, how can I get the headers that will be sent in the request?

45 Views Asked by At

I'm making a request using the Laravel Http Client, and I want to know the exact headers that will be sent (or were sent) in the request. I'm not trying to set them. I want to read them.

Does anybody know how I can do this?

1

There are 1 best solutions below

0
Mohammad On

You should enable debug output, like so :

$client->request('POST', $url, ['form_params' => [$value], 'debug' => true]);

check document

https://docs.guzzlephp.org/en/stable/request-options.html#debug