-
Notifications
You must be signed in to change notification settings - Fork 217
parse request version in extractor, refactor match_version #2383
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
Conversation
3a67a76 to
d793584
Compare
b70ffe0 to
6a811cb
Compare
|
@Nemo157 @GuillaumeGomez any chance for some feedback? I'm aware it's a big PR, but I hope it will improve some readability in the web handlers. |
|
Looks good to me but please wait for @Nemo157 review. :) |
|
@Nemo157 and chance you can find time for at least some design feedback? I would highly appreciate it |
a4dfbcf to
40ac35a
Compare
ed54de4 to
6ef7bd3
Compare
|
@Nemo157 this is ready for another round. After removing the |
Co-authored-by: Nemo157 <github@nemo157.com>
9f5d167 to
d37eceb
Compare
So, this is a somewhat mid-sized refactor in how we handle & match version requirements in requests.
The general idea is:
web::ReqVersion). It can parse static names like/latest/, but also specificsemver::Versionandsemver::VersionReq. This changes the status code for an invalid version identifier.. Previously we returned a 404, now it will be a 400. I added a customPathextractor so we have a nice error page on 400 too, so for users it should be fine.semver::Versionmatch_versionand its response types are refactored to use the newReqVersion.ReqVersionand redirect in some cases. This is replaced by introducingAxumNope::Redirectandinto_canonical_req_version_or_elsefor thematch_versionresult. This unifies the version identifier canonicalization in more places.newestor semver*to/latest/, which IMO makes more sense.I think there will also be more edge cases where the exact redirects for version identifiers are not slightly different than before, but IMO this is fine for a (mostly) web interface.