mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #26546 -- Allowed HTTPStatus enum values for HttpResponse.status.
This commit is contained in:
parent
9f8941eda4
commit
2fcafd169b
4 changed files with 28 additions and 6 deletions
|
@ -5,6 +5,11 @@ from django.db import connection, transaction
|
|||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
try:
|
||||
from http import HTTPStatus
|
||||
except ImportError: # Python < 3.5
|
||||
pass
|
||||
|
||||
|
||||
def regular(request):
|
||||
return HttpResponse(b"regular content")
|
||||
|
@ -31,3 +36,7 @@ def suspicious(request):
|
|||
def malformed_post(request):
|
||||
request.POST
|
||||
return HttpResponse()
|
||||
|
||||
|
||||
def httpstatus_enum(request):
|
||||
return HttpResponse(status=HTTPStatus.OK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue