-
Notifications
You must be signed in to change notification settings - Fork 198
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
parse request version in extractor, refactor match_version #2383
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::Version
andsemver::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 customPath
extractor so we have a nice error page on 400 too, so for users it should be fine.semver::Version
match_version
and its response types are refactored to use the newReqVersion
.ReqVersion
and redirect in some cases. This is replaced by introducingAxumNope::Redirect
andinto_canonical_req_version_or_else
for thematch_version
result. This unifies the version identifier canonicalization in more places.newest
or 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.