Closed Ciloe closed 6 years ago
Thanks for the suggestion and the PR!
However, I think we should do something more intelligent in this case, as GraphQL breaks REST principles.
The main difference between REST and GraphQL is that the body should have no influence on the result of the request for the former, whereas it is the case for the latter.
Instead, in order to add support for GraphQL, let’s create a dedicated naming strategy.
Yes, I think a new naming strategy is a good idea. But what can we use in the strategy ? I think this header is the minimum
[
'method' => $request->getMethod(),
'user_info' => $request->getUri()->getUserInfo(),
'port' => $request->getUri()->getPort(),
'scheme' => $request->getUri()->getScheme(),
'headers' => array_diff_key($request->getHeaders(), array_flip($this->blacklist)),
]
But, with my tests I can see some problems.
'body' => $request->getBody()
. If the request has generic fragments and we change the fragment signature. The naming will change, and we will loose the last name. We need then to delete and regenerate all fixtures...'query' => $request->getUri()->getQuery() // has a specific hash
for exemple, the route who call the api. If they are differents parameters, for a same route, the fixture will be the same.What is the good solution for you ?
Hi @Ciloe, as I have split the bundle's middleware in multiple libraries, let us continue the discussion in csarrazi/guzzle-cache-middleware :)
Hi, I saw a problem with the fixture file name generated by this function :
src/Cache/NamingStrategy/AbstractNamingStrategy.php
It's appear that if wee requested a graphQl API, we use the body to send the request and not the query. Is it possible to add
'body' => $request->getBody(),
in this array ?Thank you