brack3t/django-braces

JsonRequestResponseMixin: the require_json condition is incompatible with CORS

David-Guillot opened this issue · 0 comments

Hi,

Context:

  • My view has require_json set to true
  • My client is on another host than my API

Issue:

  • My browser first sends a CORS pre-flight request (OPTIONS method, so no HTTP body)
  • So i get the error 400 {"errors": ["Improperly formatted request"]}

I'll submit a patch in a few minutes, though i'm not sure it's the best approach.