@@ -192,9 +192,10 @@ const (
192
192
const (
193
193
HeaderAccept = "Accept"
194
194
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
198
199
HeaderAllow = "Allow"
199
200
HeaderAuthorization = "Authorization"
200
201
HeaderContentDisposition = "Content-Disposition"
@@ -305,9 +306,8 @@ var (
305
306
}
306
307
307
308
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
311
311
routerAllowMethods , ok := c .Get (ContextKeyHeaderAllow ).(string )
312
312
if ok && routerAllowMethods != "" {
313
313
c .Response ().Header ().Set (HeaderAllow , routerAllowMethods )
0 commit comments