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

Add a method to set the URL's query from an object #138

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

baskerville
Copy link
Contributor

Example:

let query = json!({"page": 8, "order": "asc", "details": false});
attohttpc::get("http://foo.bar").query(&query)?;

This is equivalent to reqwest's query method.

(Unfortunately, we can't use .params(query.as_object()?) here, because the ToString implementation for the string value retains the quote characters.)

Example:
```rust
let query = json!({"page": 8, "order": "asc", "details": false});
attohttpc::get("http://foo.bar").query(&query)?;
```

This is equivalent to *reqwest*'s [query
method](https://docs.rs/reqwest/latest/reqwest/blocking/struct.RequestBuilder.html#method.query).

(Unfortunately, we can't use `.params(query.as_object()?)` here,
because the `ToString` implementation for the string value retains the
quote characters.)
@sbstp sbstp merged commit b051412 into sbstp:master Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants