phpclassic/php-shopify

Add Content-Length header to GraphQL requests to comply with Shopify API changes

Closed this issue · 6 comments

Shopify just announced that starting August 1st, every POST request to its API must include either the Content-Length header or use Transfer-Encoding: chunked.

https://shopify.dev/changelog/deprecation-of-post-requests-without-a-content-length-or-transfer-encoding-chunked-header

In lib/HttpRequestJson.php, within the prepareRequest() method, the header is already present — so REST API requests are compliant.

However, for GraphQL requests, it seems the equivalent header (self::$httpHeaders['Content-Length'] = strlen(self::$postDataJSON);) is missing in lib/HttpRequestGraphQL.php, in the prepareRequest() method.

Any update on this proposed change? It is quite important

@albertogcatalan
@shevabam
Thanks, I will look into this by this weekends.

@albertogcatalan @shevabam
I have created PR #349 . Pls test and approve before I merge. (I am not in a position to test it out now, so requesting you to review and confirm.) Thanks.

@albertogcatalan @shevabam I have created PR #349 . Pls test and approve before I merge. (I am not in a position to test it out now, so requesting you to review and confirm.) Thanks.

I checked this and it is correct

#349 is now merged and released.