Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1646 closed enhancement (fixed)

[patch] HttpResponseNotAllowed to return '405's

Reported by: Ian@… Owned by: mtredinnick
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

from RFC 2616: An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource.

Index: /magik/django/http/__init__.py
===================================================================
--- /magik/django/http/__init__.py      (revision 2704)
+++ /magik/django/http/__init__.py      (working copy)
@@ -265,6 +265,11 @@
         HttpResponse.__init__(self, *args, **kwargs)
         self.status_code = 403
 
+class HttpResponseNotAllowed(HttpResponse):
+    def __init__(self, *args, **kwargs):
+        HttpResponse.__init__(self, *args, **kwargs)
+        self.status_code = 405
+
 class HttpResponseGone(HttpResponse):
     def __init__(self, *args, **kwargs):
         HttpResponse.__init__(self, *args, **kwargs)

Change History (2)

comment:1 Changed 9 years ago by mtredinnick

  • Owner changed from adrian to mtredinnick

This is a pre-requisite to fixing #2185.

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [3144]) Fixed #1646 -- Added HttpResponseNotAllowed, as suggested by Ian Holsman.

Note: See TracTickets for help on using tickets.
Back to Top