mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #26688 -- Fixed HTTP request logging inconsistencies.
* Added logging of 500 responses for instantiated responses. * Added logging of all 4xx and 5xx responses.
This commit is contained in:
@@ -1,14 +1,48 @@
|
||||
from django.core.exceptions import DisallowedHost, SuspiciousOperation
|
||||
from django.http import HttpResponse
|
||||
from django.core.exceptions import (
|
||||
DisallowedHost, PermissionDenied, SuspiciousOperation,
|
||||
)
|
||||
from django.http import (
|
||||
Http404, HttpResponse, HttpResponseRedirect, HttpResponseServerError,
|
||||
)
|
||||
from django.http.multipartparser import MultiPartParserError
|
||||
|
||||
|
||||
def innocent(request):
|
||||
return HttpResponse('innocent')
|
||||
|
||||
|
||||
def redirect(request):
|
||||
return HttpResponseRedirect('/')
|
||||
|
||||
|
||||
def suspicious(request):
|
||||
raise SuspiciousOperation('dubious')
|
||||
|
||||
|
||||
def suspicious_spec(request):
|
||||
raise DisallowedHost('dubious')
|
||||
|
||||
|
||||
class UncaughtException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def uncaught_exception(request):
|
||||
raise UncaughtException('Uncaught exception')
|
||||
|
||||
|
||||
def internal_server_error(request):
|
||||
status = request.GET.get('status', 500)
|
||||
return HttpResponseServerError('Server Error', status=int(status))
|
||||
|
||||
|
||||
def permission_denied(request):
|
||||
raise PermissionDenied()
|
||||
|
||||
|
||||
def multi_part_parser_error(request):
|
||||
raise MultiPartParserError('parsing error')
|
||||
|
||||
|
||||
def does_not_exist_raised(request):
|
||||
raise Http404('Not Found')
|
||||
|
||||
Reference in New Issue
Block a user