Skip to content

SwaggerRenderer example doesn't match the ";version=2.0" part of media_type #4287

@osantana

Description

@osantana

Checklist

  • I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

Implement the documentation example of SwaggerRenderer at: https://github.com/tomchristie/django-rest-framework/blame/master/docs/api-guide/schemas.md#L244

And try to get an HTTP request to an endpoint that uses this renderer:

http http://127.0.0.1:8000/v1/ Accept:application/openapi+json;version=2.0

Expected behavior

Get a JSON with Swagger API Schema.

Actual behavior

Get an HTTP 406:

HTTP/1.0 406 Not Acceptable
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Date: Tue, 19 Jul 2016 19:51:47 GMT
Server: WSGIServer/0.2 CPython/3.5.1+
Vary: Accept
X-Frame-Options: SAMEORIGIN

{
    "detail": "Could not satisfy the request Accept header."
}

Preliminar analisys

I've found that media_type doesn't match "version" parameter correctly in the following lines (even with */*; q=0.8 media type):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy