Skip to content
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

The query string is not present in the request object #92

Closed
Angelmmiguel opened this issue Feb 13, 2023 · 1 comment · Fixed by #93
Closed

The query string is not present in the request object #92

Angelmmiguel opened this issue Feb 13, 2023 · 1 comment · Fixed by #93
Assignees
Labels
🐛 bug Something isn't working
Milestone

Comments

@Angelmmiguel
Copy link
Contributor

When wws calls a worker, it sends the HTTP request as a serialized object. It includes all the required values to build a Request object inside the worker. Currently, the url does not include the query string. This is relevant information so we should ensure we send it as part of the URL.

pub fn new(
request: &'a HttpRequest,
body: &'a str,
kv: Option<HashMap<String, String>>,
) -> Self {
let mut params = HashMap::new();
for (k, v) in request.match_info().iter() {
params.insert(k.to_string(), v.to_string());
}
Self {
url: request.uri().path(),
method: request.method().as_str(),
headers: Self::build_headers_hash(request.headers()),
body,
kv: kv.unwrap_or_default(),
params,
}
}

The .uri().path() method doesn't include the query string. There's an alternative path_and_query() path we can use for this purpose.

@Angelmmiguel Angelmmiguel added the 🐛 bug Something isn't working label Feb 13, 2023
@Angelmmiguel Angelmmiguel added this to the v1.0.0 milestone Feb 13, 2023
@Angelmmiguel Angelmmiguel self-assigned this Feb 13, 2023
@Angelmmiguel
Copy link
Contributor Author

This issue was affecting the tic-tac-toe example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant