Limit content-types in request body?

18 views
Skip to first unread message

Adam Fletcher

unread,
Oct 11, 2020, 2:36:05 PM10/11/20
to django-res...@googlegroups.com
Hi folks,

I'd like to limit the request body types I accept to just JSON (this is oddly to work around an `openapi-generator` bug). I see that I can add a `accepted_media_type` to requests - but is there a way to do this for all DRF requests?

Thanks!

-Adam

Carl Nobile

unread,
Oct 11, 2020, 6:19:27 PM10/11/20
to django-res...@googlegroups.com
You might want to look at the docs for different methods of versioning. The way you do versioning is directly related to how you will use mime types in your code.
I personally use the mine type to determine the versions, this allows you to change the version on any endpoint just by changing the version on the mime type.

~Carl

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/CAEP43uPn7UR4gDECrHHk6eZj%3Dnd9y3ETs2irSRJgrq-gFJWSHA%40mail.gmail.com.


--
-------------------------------------------------------------------------------
Carl J. Nobile (Software Engineer)
carl....@gmail.com
-------------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages