Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Can't not work with swagger.js #798

Open
ZhouHansen opened this issue Mar 29, 2019 · 2 comments
Open

Can't not work with swagger.js #798

ZhouHansen opened this issue Mar 29, 2019 · 2 comments

Comments

@ZhouHansen
Copy link

ZhouHansen commented Mar 29, 2019

swagger.js hardcodes the request http header Accept: application/json, so it will return 406 Not Acceptable, when request from http://mydomain/schema/?format=openapi, because its repsonse Header is Content-Type: application/openapi+json. So, Can we change the Content-Type to application/json. Thanks.

@ZhouHansen
Copy link
Author

ZhouHansen commented Mar 30, 2019

class MyView(View):

    def get(self, request, *args, **kwargs):
        response = schema_view(request)
        response["Content-Type"] = "application/json"
        return response

This does not work. Content-type seems to be hardcoded.

@ZhouHansen
Copy link
Author

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

No branches or pull requests

1 participant