Skip to content

#[route] macro without method #3259

Answered by robjtede
tp971 asked this question in Ideas
Jan 22, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote
#[route("/some/path")]

I can see this being dangerous to allow in the general case. You can imagine a scenario where a developer thinks this is just for GETs and then deploying an app where it's problematic to receive a POST.

I think safer to push people towards the existing solutions, either:

  • specifying all the supported HTTP methods using #[route("/", method = GET, method = POST, ...)];
  • using manual routing where .route("/", web::route().to(handler)) or a resource with .default_service(handler) configured achieves it for arbitrary methods, too.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tp971
Comment options

@robjtede
Comment options

Answer selected by robjtede
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants