Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trailing_slash argument to the session #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iamanikeev
Copy link

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 :)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 88.407% when pulling 0398ee0 on iamanikeev:support-apis-with-trailing-slash-requirement into 9df28f5 on qvantel:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 88.407% when pulling 0398ee0 on iamanikeev:support-apis-with-trailing-slash-requirement into 9df28f5 on qvantel:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants