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

Always set bundle + coerce query params #86

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

stevelacey
Copy link
Contributor

@stevelacey stevelacey commented Dec 16, 2021

What does this PR do?

Makes the bundle always available via GET, currently only available on list apis, and adds coersion for true/false/null when the bundle is derived from the query string.

Note that this coercion is more strict than elsewhere given we can't assume that string isn't the correct type unless it's precisely these values.

We can't assume that 0/1 are bools, or that a numeric string should be an int, but we can reasonably assume that no one wants a string "true"/"false"/"null" when passing query params.

What issue does this solve?

The bundle provides a selection of conveniences over using the request QueryDicts directly, so needs to be available always, life also gets a lot easier when query string bools are bools.

This makes it easier for developers to patch in arbitrary API tweaks like swapping out a serializer when a query parameter like ?nextgen=true is passed.

Checklist

  • This PR increases test coverage

@stevelacey stevelacey force-pushed the improvement/always-bundle branch from bc0a567 to e0b22ac Compare December 16, 2021 08:05
@stevelacey stevelacey force-pushed the improvement/always-bundle branch from e0b22ac to a05e69a Compare December 16, 2021 11:43
@stevelacey stevelacey merged commit 0f17ff0 into master Dec 17, 2021
@stevelacey stevelacey deleted the improvement/always-bundle branch December 17, 2021 08:26
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.

1 participant