Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brad_youhq's avatar

Force fresh HTTP Client each call

Hey Gang

I am using the Laravel HTTP client to fetch products from Shopify. When I do a pagination call on the products, Shopify responds with an Invalid Key. The initial page request contains basic authentication then the following pages hit the Shopify endpoint with a parameter Shopify provides to fetch the next pages.

The same call works when I swap my code to use Curl instead of HTTP client. I have tried the same calls using Postman as well to see if I can replicate the API Key error but cannot.

I think the HTTP client may be reusing the previous session, cookies or something else and sending Shopify data that will cause the issue. I have don't everything except sniff the connection (don;t want to go there unless I have to).

My question is, is there a way to force the HTTP client or underlying Guzzle session to reset every time i make a call? I would love to use the inbuilt HTTP client but if its trying to resend data from a previous session then I might need to recode my entire app to use Curl instead.

Thanks in advance for any help.

0 likes
0 replies

Please or to participate in this conversation.