joshbuddy / http_router

A kick-ass HTTP router for use in Rack
MIT License
198 stars 44 forks source link

Use a consistent list of HTTP verbs for validation and helpers #39

Closed jimmycuadra closed 10 years ago

jimmycuadra commented 10 years ago

This patch unifies logic related to the supported HTTP verbs. HttpRouter::Route::VALID_HTTP_VERBS is now the canonical list of supported verbs. Two verbs were added that were not supported at all before: LINK and UNLINK.

The route helpers in HttpRouter and HttpRouter::RouteHelper are now dynamically generated from the constant list of valid HTTP verbs, as they were previously inconsistent with each other as to which verbs had helper methods. GET is still defined normally in both objects, since it's a special case that responds to both GET and HEAD.

Additionally, RouteHelper#add_request_method will now raise a clearer exception when an unsupported method is used.

joshbuddy commented 10 years ago

I'll merge this ... the only thing that makes me slightly sad is the loss of documentation ... this will not generate as clean rdoc. Oh well.

joshbuddy commented 10 years ago

And thank you very much for adding this!