This repository was archived by the owner on Jul 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
Mock filename tokenizer #3
Copy link
Copy link
Open
Description
Hi, I saw a problem with the fixture file name generated by this function :
src/Cache/NamingStrategy/AbstractNamingStrategy.php
protected function getFingerprint(RequestInterface $request)
{
return md5(serialize([
'method' => $request->getMethod(),
'path' => $request->getUri()->getPath(),
'query' => $request->getUri()->getQuery(),
'user_info' => $request->getUri()->getUserInfo(),
'port' => $request->getUri()->getPort(),
'scheme' => $request->getUri()->getScheme(),
'headers' => array_diff_key($request->getHeaders(), array_flip($this->blacklist)),
]));
}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 ?
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.
- If we use the body :
'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... - If we use a personal hash in the query :
'query' => $request->getUri()->getQuery() // has a specific hashfor exemple, the route who call the api. If they are differents parameters, for a same route, the fixture will be the same. - If we use a personal hash in the query with parameters, it will be the same problem if we add a parameter.
What is the good solution for you ?
Metadata
Metadata
Assignees
Labels
No labels