django-rest-swagger icon indicating copy to clipboard operation
django-rest-swagger copied to clipboard

Can't not work with swagger.js

Open ZhouHansen opened this issue 5 years ago • 2 comments

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 avatar Mar 29 '19 09:03 ZhouHansen

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 avatar Mar 30 '19 04:03 ZhouHansen

https://github.com/swagger-api/swagger-js/issues/1430

ZhouHansen avatar Apr 04 '19 08:04 ZhouHansen