8thlight / cob_spec

A fitnesse suite for a web server
24 stars 33 forks source link

Response to bogus requests in MethodNotAllowed #70

Open kkrull opened 6 years ago

kkrull commented 6 years ago

BogusRequest appears to be creating requests with randomly generated HTTP methods, and spec always requires the response to be 405 Method Not Allowed. Depending on what method name is randomly generated:

The last paragraph in RFC7231 Section 4 says as follows:

When a request method is received
that is unrecognized or not implemented by an origin server, the
origin server SHOULD respond with the 501 (Not Implemented) status
code.  When a request method is received that is known by an origin
server but not allowed for the target resource, the origin server
SHOULD respond with the 405 (Method Not Allowed) status code.

Should MethodNotAllowed be refactored to use one of the other IANA methods that is not used elsewhere in cob_spec -- maybe TRACE or CONNECT?

jdesrosiers commented 6 years ago

Good catch! I missed that one. I'd love to see a PR addressing this issue.