On Wed, Nov 20, 2019 at 3:44 PM Curtis Maloney <cur...@tinbrain.net> wrote:
> > Yeah, I expected DRF had this "solved" already. From my own > experimentation, mapping `cgi.parse_header` over the the "Accept" header > value, split by comma, gets a usable result; then sort that list by 'q' > (defaulting to 1.0) and you have your priority. > Both the original and forks seem to've been abandoned now, but the mimeparse library encapsulated this into a nice little function that took an Accept header, and a list of content-types you could support in the response, and told you which one was the best match. The code's still out there and under a permissive license if somebody wants to pick it up again. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAL13Cg9x9ZWM0LTLoMMF%3DxgMydqrOKhEnhsRn-miFkVk5Rx6tg%40mail.gmail.com.