pyFF returns correct response (cached or not) depending on the value of the Accept header.
Current Behavior
Request / response caching relies only on the request's path which is not unique enough to provide consistent results.
def request_handler(request: Request) -> Response:
"""
The main GET request handler for pyFF. Implements caching and forwards the request to process_handler
:param request: the HTTP request object
:return: the data to send to the client
"""
key = request.path_qs
r = None
try:
r = request.registry.cache[key]
except KeyError:
pass
if r is None:
r = process_handler(request)
request.registry.cache[key] = r
return r
If I enable caching and issue two requests to the same path, with the only difference being that each request uses a different value for the Accept header, pyFF will return the same result.
Possible Solution
Cache key should include the request mimetype or we should cache something else (not the entire Response).
Steps to Reproduce
Pipeline file, in my case, is heavily inspired by the examples/edugain-mdq.fd and has a couple of changes that are irrelevant to the issue.
Code Version
2.1.2
Expected Behavior
pyFF
returns correct response (cached or not) depending on the value of theAccept
header.Current Behavior
Request / response caching relies only on the request's path which is not unique enough to provide consistent results.
If I enable caching and issue two requests to the same path, with the only difference being that each request uses a different value for the
Accept
header,pyFF
will return the same result.Possible Solution
Cache key should include the request mimetype or we should cache something else (not the entire
Response
).Steps to Reproduce
examples/edugain-mdq.fd
and has a couple of changes that are irrelevant to the issue.pyffd
withcaching_enabled
:pyFF
: