Closed totycro closed 2 weeks ago
This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.
As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.
Description When using
pygeoapi --starlette
and adding the request headerAccept-Encoding: gzip
, the response is not actually gzipped.The problem lies in these two lines: https://github.com/geopython/pygeoapi/blob/master/pygeoapi/api.py#L640
https://github.com/geopython/pygeoapi/blob/master/pygeoapi/api.py#L625
In starlette, header names are case insensitive (as by HTTP spec). So you can do
accept-encoding in request.headers
orAccept-Encoding in request.headers
and both will returnTrue
. However inget_request_headers
, the headers are listed, and in this operation the names are lower cased.Thus in
get_response_headers
,Accept-Encoding
can never actually be present in the headers dict, onlyaccept-encoding
.Note that this bug probably doesn't cause more problems since the request headers only seem to be used for gzip here.
Here's the starlette documentation: https://www.starlette.io/requests/#headers
A fix could be to lowercase all request headers in
get_request_headers
Expected behavior The response should be gzipped.
Screenshots/Tracebacks An example set of request headers as printed in starlette:
Environment