I have created a response object in my django view by calling HttpResponse
myResponse = HttpResponse("Here is some text")
and I want to set set the Access-Control-Allow-Credentials header on the response to be true. Should this be set with a python string like I do for other headers
myResponse['Access-Control-Allow-Credentials'] = 'true'
or with a python boolean
myResponse['Access-Control-Allow-Credentials'] = True
or will either work? (and if they will both technically work, is one more "correct")
Go with:
myResponse['Access-Control-Allow-Credentials'] = 'true'
If the Boolean True
is serialized as "True" then some browsers might not accept it
Seems like the string version is correct:
https://github.com/prasanthn/django-dcors/blob/master/dcors/dcorsmiddleware.py#L67
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.