@@ -192,9 +192,10 @@ const (
192192const (
193193 HeaderAccept = "Accept"
194194 HeaderAcceptEncoding = "Accept-Encoding"
195- // HeaderAllow is header field that lists the set of methods advertised as supported by the target resource.
196- // Allow header is mandatory for status 405 (method not found) and useful OPTIONS method responses.
197- // See: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1
195+ // HeaderAllow is the name of the "Allow" header field used to list the set of methods
196+ // advertised as supported by the target resource. Returning an Allow header is mandatory
197+ // for status 405 (method not found) and useful for the OPTIONS method in responses.
198+ // See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1
198199 HeaderAllow = "Allow"
199200 HeaderAuthorization = "Authorization"
200201 HeaderContentDisposition = "Content-Disposition"
@@ -305,9 +306,8 @@ var (
305306 }
306307
307308 MethodNotAllowedHandler = func (c Context ) error {
308- // 'Allow' header RFC: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1
309- // >> An origin server MUST generate an Allow field in a 405 (Method Not Allowed) response
310- // and MAY do so in any other response.
309+ // See RFC 7231 section 7.4.1: An origin server MUST generate an Allow field in a 405 (Method Not Allowed)
310+ // response and MAY do so in any other response. For disabled resources an empty Allow header may be returned
311311 routerAllowMethods , ok := c .Get (ContextKeyHeaderAllow ).(string )
312312 if ok && routerAllowMethods != "" {
313313 c .Response ().Header ().Set (HeaderAllow , routerAllowMethods )
0 commit comments