http-rs / http-types

Common types for HTTP operations
https://docs.rs/http-types
Apache License 2.0
200 stars 83 forks source link

Support all the registered HTTP methods in the `Method` enum #332

Closed zenekron closed 3 years ago

zenekron commented 3 years ago

This PR extends the Method enum to add all the missing methods from IANA's HTTP Method Registry. See the issue #331 .

Changes:

jbr commented 3 years ago

Out of curiosity, what is the use case for having WebDAV extensions in http-types?

zenekron commented 3 years ago

Out of curiosity, what is the use case for having WebDAV extensions in http-types?

Besides being able to speak WebDAV itself, there are other tools that reuse subsets of these methods for other purposes.

In my case specifically: I'm porting a small Terraform HTTP backend I wrote from warp to tide, but in order to implement state locking I need to be able to handle LOCK and UNLOCK requests (link).

jbr commented 3 years ago

Does this mean you'd also want affordances in tide's router for these methods?

zenekron commented 3 years ago

Does this mean you'd also want affordances in tide's router for these methods?

I'm not too sure what you mean by that (not a native English speaker here), but if you're talking about creating methods like tide::Route::get and tide::Route::post that wrap around tide::Route::method, then I think these HTTP methods are uncommon enough that doing so would not bring much benefit.

That being said if you think it's appropriate I can open a PR against tide as well, just let me know.

Fishrock123 commented 3 years ago

if you're talking about creating methods like tide::Route::get and tide::Route::post that wrap around tide::Route::method

That is indeed what @jbr meant.

yoshuawuyts commented 3 years ago

I think these HTTP methods are uncommon enough that doing so would not bring much benefit.

I agree with this rationale; I don't think we need to expose shorthands for them, but having them as part of the enum seems reasonable enough.