Skip to content

Conversation

terencehonles
Copy link
Contributor

This change fixes an OPTIONS request to the API page which will return a successful response, but the TemplateHTMLRender will not be prepared to render it since there is no template name provided in either the view or response.

This change fixes an `OPTIONS` request to the API page which will return
a successful response, but the `TemplateHTMLRender` will not be prepared
to render it since there is no template name provided in either the view
or response [1].

[1]: https://github.com/encode/django-rest-framework/blob/f0a5b958a134e8cd94e3ef3263e8fa623ac9b82f/rest_framework/renderers.py#L178-L189
# see https://github.com/axnsan12/drf-yasg/issues/58
return TemplateHTMLRenderer().render(swagger, accepted_media_type, renderer_context)
except ImproperlyConfigured:
# Fall back to using eg '404 Not Found'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoelLefkowitz JoelLefkowitz changed the base branch from master to 1.20.x September 24, 2021 06:46
@JoelLefkowitz JoelLefkowitz added 1.21.x Release target in 1.21.x and removed 1.20.x labels Jul 17, 2022
@JoelLefkowitz JoelLefkowitz changed the base branch from 1.20.x to 1.21.x July 17, 2022 17:08
@JoelLefkowitz JoelLefkowitz merged commit f87dbd5 into axnsan12:1.21.x Jul 18, 2022
@terencehonles terencehonles deleted the handle-errors-rendering-with-TemplateHTMLRenderer branch July 18, 2022 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.x Release target in 1.21.x bug Bug report
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants