actix-web
actix-web copied to clipboard
Add macro for route handler accepting all HTTP methods
As discussed in https://github.com/actix/actix-web/discussions/3259, implement macros like #[any("...")] and #[route("...", method = any)] to create route handlers accepting all HTTP methods (which is currently only possible with something like app.route("...", web::route().to(handler)))
I will like to take this issue, can you help me figure out the initials and the codebase?
Or provide more information
You can look inside the actix-web-codegen crate source. I'd recommend adding a trybuild test first using the format mentioned in the OP issue and discussion post.
When I tried to run trybuild tests using cargo test --test trybuild or even just cargo test, it shows that 0 tests were run. Am i making a mistake? @robjtede
Good point. The trybuild tests only run on our MSRV. So Rust 1.72.
I don't know if it's a dumb question buy may I ask whether the HTTP methods are imported from inbuilt libraries or defined within the source code itself. If they are defined please could you specify where? @robjtede
I figured out that it is exported. Now, I will work on defining ALL method kind of thing because an error related to naming conflict was generated
Can you guide me on that a little @robjtede ? It's been quite a task
@sabinonweb Do you want to open a draft PR so I can see where you've gotten to?
@robjtede please have a look
@robjtede I would love a comment
I left some comments earlier. See the PR.
Would adding methods in with_any_methods, similar to with_methods work @robjtede