-
Notifications
You must be signed in to change notification settings - Fork 255
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
Rust SDK: Query params seem to be missing from http::Request #313
Comments
This has been a source of vigorous discussion and (to me at least) total confusion. The My advice to young developers such as yourself is to avoid @radu-matei Do we document the semantics of the |
The discussion is here, and if the final post is still current, further demonstrates my confusion - apparently the |
Hang on, the Request object passed to the SDK handler method doesn't seem to match the "HTTP objects" described on the https://spin.fermyon.dev/http-trigger page. So maybe I am completely misleading you. |
I think the SDK macro is generating a Rust @fibonacci1729 I think at spin/sdk/rust/macro/src/lib.rs Line 52 in 2be4034
params member of the source object, or using the spin-full-url header.
|
I am not sure what you are suggesting, but inside of a component, the only thing I get is the |
Yeah I think the Spin site (and the issue I linked to) covers the "raw" request type and I hadn't clocked that the macro SDK converts it to the "native" Request type (but that the macro contains a bug where it doesn't restore the query). Sorry. |
I have been using these two things as reference:
If you wanna direct me to something else, I'll give it a try. |
No, it's just a bug in the SDK, hence tagging Brian with the location of the bug. Sorry for confusing the issue. |
This is how the parameters should be obtained when using the Rust SDK, and this is definitely a bug. |
If I send a request like
http://localhost:3000/index?foo=bar&baz=sprocket
, I would expect the query parameters to be available on the URI object.However, if I do
req.uri()
, the URL does not have query parameters attached. This is easy to replicate by just printing theuri()
. However, since currently every request seems to be automatically printed to STDOUT, you can see this in the log without doing anything special.Command:
curl localhost:3000/tally\?ulid=1234\&foo=bar
(Note that backslashes are just for shell escaping)Content of the STDOUT log:
The text was updated successfully, but these errors were encountered: