﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36734	Clarify documentation about default implementation of `http_method_not_allowed`	xingyu lin	zubair	"https://docs.djangoproject.com/en/5.2/ref/class-based-views/base/#django.views.generic.base.View.http_method_not_allowed

The quoted description:

{{{
If the view was called with an HTTP method it doesn’t support, this method is called instead.

The default implementation returns HttpResponseNotAllowed with a list of allowed methods in plain text.
}}}
 
The original description would make you assume that it returns HttpResponseNotAllowed(http 405) **with content** containing a list of allowed methods in plain text.

But in fact, the default implementation returns HttpResponseNotAllowed **with headers[Allow]** containing a list of allowed methods in plain text, not in the content.

{{{
class TestView(View):
  def get(self, req):
    return HttpResponse('ok')

class Test(TestCase):
  def test(self):
    resp = self.client.post('/test')

    # The content is empty.
    # Allowed methods are in headers['Allow'].
    self.assertEqual(resp.content, b'')
    self.assertEqual(resp.headers['Allow'], 'GET, HEAD, OPTIONS')
}}}

"	Cleanup/optimization	closed	Documentation	dev	Normal	fixed		Youngkwang Yang	Ready for checkin	1	0	0	0	0	0
