Closed justb4 closed 5 years ago
To be complete some tests need to be added in test_check_format() for "browser Accept Header" where we initially ran into and was the reason for this issue. A typical browser Accept Header may look like:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
A PR is a bit overkill to add lines in test_check_format() :
headers_['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,'
assert check_format({}, headers_) == 'html'
headers_['accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,'
assert check_format({}, headers_) == 'html'
Thanks @justb4; added in 20c96a8f4756aabad60fb0a39704de2b715715c6
Running plain pygeoapi in virtualenv Python 3.7.1 Ubuntu 18.04 and requesting any URL via the browser all requests return:
We expect
collections
etc.Inspecting the code it appears to come out of the function
pygeoapi.py: check_format()
, in particular this line will return a list of accept formats so the check on this line will always fail.Have tested and will make a PR, replacing the
check_format()
function with something like:This works for us, both with query parm, and even default (neither
f=
noraccept
headers).