-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Can't use uri! with routes that have optional query params #827
Comments
I don't think the linked commit resolves the issue, as I'm having the same problem and the provided code snippet continues to fail:
My use-case is that several parameters are optional for an endpoint. They are then passed through to a pagination template which generates "next" and "page number" links, keeping the values of the optional parameters so that the user's filters and searches persist. However this is currently not possible using the
you get:
Obviously this is not ideal. |
@cazgp How did you define the route in question? |
Similarly to the OP's code snippet, which doesn't compile. Optional URL query params. |
It turns out that what was implemented does not allow exactly what was originally posted for this issue. You can either provide a value (without |
Can we re-open this issue then please? It appears to be either a feature request or a bug. If there's a route with multiple optional parameters, a separate function which manually builds the URL is needed, because otherwise it ends up with a combinatorial explosion of the |
The version of Rocket you're using. Ensure it's the latest, if possible: 0.4.0-rc.1
The operating system (distribution and version) where the issue occurs: macOS 10.14.1
A brief description of the bug: It is not possible to use
uri!
for a route that has optional query params (Option<T>
).How you uncovered the bug. Short, reproducible tests are especially useful.
the trait rocket::http::uri::FromUriParam<_> is not implemented for std::option::Option<u64>
The text was updated successfully, but these errors were encountered: