jsonapi-client
jsonapi-client copied to clipboard
Add `trailing_slash` argument to the session
Problem:
Django and DRF have a combination of options that makes Django either redirect with 301 or return 404 error when URL is missing a trailing slash before the query params:
https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-APPEND_SLASH https://www.django-rest-framework.org/api-guide/routers/#simplerouter
In both cases jsonapi-client fails to fetch the resource because it either faces the 404 or some headers get lost during the redirection, and response doesn't contain a valid JSON.
Suggestion:
I suggest adding an option to the session that would allow to handle this situation. I might miss some other places where the trailing slash should be appended though :)
Coverage decreased (-0.1%) to 88.407% when pulling 0398ee00921b53be84c7b5212ceeb76a99c6ded1 on iamanikeev:support-apis-with-trailing-slash-requirement into 9df28f536e84f5eb7a5dc771056ea525e5f9439f on qvantel:master.