Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow changing of format with query parameter #812

Open
Labels
@sliverc

Description

@sliverc

Issue

The guides onhttps://django-rest-framework-json-api.readthedocs.io/en/stable/usage.html#configuration recommend including therest_framework_json_api.filters.QueryParameterValidationFilter in initial configuration which is good advice, but by default, the Django REST Framework UI provides a dropdown which allows you to pickformat=api orformat=vnd.api+json

screenshot at 2018-12-28 15-10-51

Without allowing theformat parameter through you get the following error:

HTTP 400 Bad RequestAllow: GET, POST, HEAD, OPTIONSContent-Type: application/vnd.api+jsonVary: Accept{    "errors": [        {            "detail": "invalid query parameter: format",            "source": {                "pointer": "/data"            },            "status": "400"        }    ]}

What needs to change

  • We document to changeURL_FORMAT_OVERRIDE tocontentFormat in our README.
  • In theQueryParameterValidationFilter it's checked whether a query parameter is passed on which is equal configured value inURL_FORMAT_OVERRIDE. If this is true and the value ofURL_FORMAT_OVERRIDE is set to something else thanformat then we let the user pass. IfURL_FORMAT_OVERRIDE is still set toformat a 400 error is raised (as would be the case today already without this change).

referenceDRF docs

This issue is created out of the pull request#535

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp