Replies: 1 comment
-
like this? Router::with_path("my-endpoin").push(
Router::with_filter_fn(|req, _|{
req.header::<String>("x-api-version").as_deref() == Some("version1")
}).get(version1)
).push(
// This is for header has version 2 and without header.
Router::new().get(version2)
) If you like salvo, give it a star, thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm implementing header-based API versioning using the
x-api-version
header.My goals are:
handler-1
forversion-1
,handler-2
forversion-2
) based on the header value./my-endpoint
for all versions.handler-2
).I'd appreciate assistance in determining the best way to achieve this.
Thanks guys!
Beta Was this translation helpful? Give feedback.
All reactions