Replies: 1 comment 4 replies
-
Guiding you kindly towards discussions... :) I'm not able to replicate this... urls.py from django.urls import path
from rest_framework.decorators import api_view, parser_classes
from rest_framework.parsers import JSONParser
@api_view(['POST'])
@parser_classes([JSONParser])
def homepage(request):
request.data['change_me'] = 'MyValue'
urlpatterns = [
path('', homepage),
] client.py:
shell:
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checklist
With the following view:
By sending a request with
Content-Type: multipart/form-data
(with at least one key/value pair, if it's empty it still goes through but doesn't trip up weirdly enough) one will observe the following behaviour:AttributeError at $myViewsURL This QueryDict instance is immutable
What surprises me is that as I've specified the use of only the
JSONParser
, I should expectrequest.data
to be adict
. I've tried other content-types and they are correctly rejected before parsing, but this one goes through.Beta Was this translation helpful? Give feedback.
All reactions