lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Support for custom HTTP methods

Open ahmadnassri opened this issue 10 years ago • 9 comments

currently it takes quite a considerable effort to create work-arounds to support HTTP methods such as PATCH, which behavior shouldn't really differ from POST (or any other method for that matter)

is there a reason for the core to be opinionated such as it is today? even with things like request bodies coupling with the HTTP Method behavior?

as far as the HTTP Spec goes, there is no limit to what HTTP Method strings can be/ (GET, POST, etc ...) being the common ones, and there is certainly no requirement nor association with HTTP Methods and request bodies beyond tradition.

will there be future plans to allow free-form HTTP method usage and decoupling the HTTP Method parsing from any further actions within the app?

if nothing else, then at the very least adopt the IANA Registery of HTTP Methods.

ahmadnassri avatar May 14 '15 21:05 ahmadnassri

+1

subnetmarco avatar May 14 '15 21:05 subnetmarco

:+1:

nijikokun avatar May 14 '15 21:05 nijikokun

respond_to supports any verb: http://leafo.net/lapis/reference/actions.html#handling-http-verbs

Or is this in response to the helper methods get, post etc on Application in the Lua API docs? Those are just convenience wrappers on top of respond_to.

It looks like there is no documentation for respond_to except on the MoonScript page, I can add it elsewhere.

leafo avatar May 14 '15 21:05 leafo

Or is this in response to the helper methods get, post etc on Application in the Lua API docs? Those are just convenience wrappers on top of respond_to.

The minimum convenience wrappers should at least cover the following: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

nijikokun avatar May 14 '15 21:05 nijikokun

@leafo that helps a lot, was looking at the lua docs only, and yes for minimal convenience, as @Nijikokun indicated, should at least follow the IANA registery I believe.

ahmadnassri avatar May 14 '15 21:05 ahmadnassri

should at least follow the IANA registery I believe

That would be the most optimal: http://www.iana.org/assignments/http-methods/http-methods.xhtml

nijikokun avatar May 14 '15 22:05 nijikokun

@ahmadnassri I moved over a handful of documentation that was only available on the MoonScript into, you might want to look over http://leafo.net/lapis/reference/actions.html again to pick up anything you may have missed.

leafo avatar May 14 '15 23:05 leafo

@leafo awesome, thank you!

ahmadnassri avatar May 15 '15 03:05 ahmadnassri

@leafo Wouldn't fufilling @nijikokun 's request of supporting these methods be as simple as modifying this line to add the additional wrappers?

If so and you don't have any objections, I'll create a pull request to do just that. Are there any methods you don't want to use because they might clash with functionality you might add in the future?

TangentFoxy avatar Aug 03 '16 08:08 TangentFoxy