-
Notifications
You must be signed in to change notification settings - Fork 76
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
POST request key generation. #170
Comments
POST queries should not be cached.
https://www.rfc-editor.org/rfc/rfc7234#section-4 In your example, I think that the server should accept |
Should but service does not follow it 😅 . |
I don't have control over a third party's poor API implementation 😅 but I do need the ability to cache the responses for debugging purposes. Besides, there is a limit how how long query parameters can be, so sometimes APIs are forced to accept POST for requests that are otherwise GET-like in behavior. Also, all GraphQL requests use POST, even though it's well accepted that that's the way it works, even if you only request data to read. |
We also use GraphQL and us cache key is always the same, so it doesn't work for us. |
Test which.
Expect that the third request will trigger a network call... but instead, it uses cache.
Due to:
\Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy::getCacheKey
All CacheStrategyInterface use the following line to generate cache key
$request->getMethod().$request->getUri().json_encode($cacheHeaders)
. Which does not include request body.I think for POST request it is fair to add body for cache key as well.
Version:
kevinrob/guzzle-cache-middleware v3.5.0
The text was updated successfully, but these errors were encountered: