-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for creating custom methods with route macro #2969
Conversation
b2f9c7f
to
d358919
Compare
I'd like to avoid needing a new type in actix_web. We already have the Method guard which should be used for this feature. |
…nto custom_methods
Thanks. I tried to make it work. Sorry for all the bad commits. I'm not familiar with git enough. Need to brush up my skills. |
would be good to add at least one test for failure cases like lowercase |
done. added a trybuild method for that with stderr similar to other tests. |
@robjtede sorry for the repeated small fixes. I'm having trouble testing out the trybuild tests or the github action tests in local environment hence not able to fix them in one go. |
It should be enough to install the 1.59.0 toolchain and run |
I tried to make it work this way earlier but always greeted with the following error: ❯ TRYBUILD=override cargo +1.59.0 test
Updating crates.io index
error: failed to select a version for the requirement `time = "^0.3"`
candidate versions found which didn't match: 0.3.15, 0.3.14, 0.3.13, ...
location searched: crates.io index
required by package `actix-web v4.3.0 (/home/user/actix-web/actix-web)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, thanks 👍
PR Type
An improvement to existing feature.
PR Checklist
Overview
Current Behavior:
If we wish to use custom methods using the route macro, it causes panic due to Unexpected HTTP method.
New Behavior:
This would be a valid format - and we can curl with either of the three methods (Provided it's an uppercase ASCII).
To achieve this, I added a Custom Method in MethodTypes which supported any uppercase Method that isn't one of the standard ones.
Extra:
I haven't yet added the tests and documentation for it - but I plan to do it slowly as the issue progresses.
Closes #2893