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

JSON indent parameter in Accept header ignored #4281

Closed
nealtodd opened this issue Jul 18, 2016 · 2 comments
Closed

JSON indent parameter in Accept header ignored #4281

nealtodd opened this issue Jul 18, 2016 · 2 comments
Labels
Milestone

Comments

@nealtodd
Copy link

nealtodd commented Jul 18, 2016

Refactoring between 3.3.3 and 3.4.0 changed how Response.render passes media_type to its renderer.

Response sets it as media_type = renderer.media_type compared to self.accepted_media_type (set via APIView.finalize_response here).

Since renderer.media_type looses the indent parameter (i.e. application/json; indent=4 becomes application/json), the resulting JSON rendering is not indented.

A 'simple' fix is to restore the 3.3.3 code where media_type = getattr(self, 'accepted_media_type', None) but I haven't made a PR yet because I'm not clear as to whether there was a specific reason for changing to renderer.media_type (which might have overlooked that it doesn't include indent).

@pembo13
Copy link

pembo13 commented Jul 22, 2016

I can confirm, the media_type value that get_ident receives is stripped of params.

@tomchristie tomchristie added this to the 3.4.1 Release milestone Jul 26, 2016
@tomchristie tomchristie changed the title 3.4.0: JSON indent parameter in Accept header ignored JSON indent parameter in Accept header ignored Jul 27, 2016
@tomchristie
Copy link
Member

tomchristie commented Jul 27, 2016

Thanks for raising this. Addressed in #4313.

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

No branches or pull requests

3 participants