Questions tagged [reqwest]

reqwest is a high-level Rust HTTP client library that aims to be convenient and capable.

Documentation is available at https://docs.rs/reqwest/latest/reqwest/

215 questions
5
votes
1 answer

Is there a way to set the maximum pool size for a client in Reqwest?

All I've found is that ClientBuilder has an option for setting the maximum idle connections per host, but this doesn't seem to give an overall limit to the number of connections available.
CyanRook
  • 8,664
  • 4
  • 21
  • 20
5
votes
1 answer

How can I fix "AsyncFactory<_, _> is not implemented" error in Actix-Web?

This is my code. I'm trying to get posts from the Rust subreddit. I would be using Actix's built in client, but it's not working on Windows, hence the use of reqwest instead: [dependencies] actix-web = "1.0.8" futures = "0.1.29" reqwest =…
Rokit
  • 977
  • 13
  • 23
4
votes
3 answers

How to serialize a struct containing f32 using serde_json?

Relatively new to Rust. I am trying to make an API call which requires the JSON body to be serialized. The JSON body contains an order_amount key with value which can only take values having INR format 100.36, i.e. Rupees 100 and paise 36. Some more…
snipedown21
  • 105
  • 8
4
votes
0 answers

CAP_NET_ADMIN causes SSL to break in rust binary

I am working on a rust networking application. And I download a package from gcloud storage (using an https://... URL). I will eventually need the capabilities CAP_NET_ADMIN and CAP_NET_RAW. This is my rust program: pub fn…
4
votes
1 answer

Deserialize a reqwest::Reponse to JSON but print response text on error

I'm decoding a reqwest::Response to JSON. Usually that works fine, but in some rare cases the remote server returns a response that doesn't fit my struct that I'm using for deserialization. In those cases I'd like to print out the original response…
Florian Brucker
  • 9,621
  • 3
  • 48
  • 81
4
votes
1 answer

Where is the body of a HTTP response stored? (with Rust + reqwest)

I've been messing around with HTTP over the past few days by building a simple CL download manager in Rust using the reqwest crate to handle the HTTP stuff. I've got a basic understanding of how the protocol works - what headers to look for when…
James Mclaughlin
  • 570
  • 1
  • 8
  • 16
4
votes
1 answer

How to exclude a particular crate-type from build?

My Rust project depends on crate reqwest which depends on hyper. When I build my project for Android platform cargo.exe build --target aarch64-linux-android cargo cannot find cc. Compiling hyper v0.14.4 error: linker `cc` not found = note: The…
iggr
  • 41
  • 4
4
votes
3 answers

How do I make an HTTP request within a wasm_bindgen function in Rust?

I am developing a NODE JS package using Rust and wasm-pack to compile, and I need to make HTTP requests in my code. I tried to use reqwest library, so everything works fine in the test but I get an error in packing. #![allow(non_snake_case)] use…
Fomalhaut
  • 8,590
  • 8
  • 51
  • 95
4
votes
1 answer

Grabbing a response header value with reqwest in rust

Ive mainly been experimenting with the reqwest module over the past few days to see what i can accomplish, but i came over a certain problem which im not able to resolve. Im trying to retrieve the a response headers value after doing a post request.…
Matthew Ransley
  • 106
  • 1
  • 10
4
votes
1 answer

How do I tell std::io::copy in Rust to stop reading and finish up writing?

I'm doing a direct download of an MP3 audio stream via Rust. As this stream is indefinite, I want to be able to cancel it early to save what I have downloaded so far. Currently, I do this by pressing CTRL + C to stop the program. This results in a…
Newbyte
  • 2,421
  • 5
  • 22
  • 45
4
votes
1 answer

The trait `std::future::Future` is not implemented for `std::result::Result`

I'm trying to run basic reqwest example: extern crate reqwest; extern crate tokio; #[tokio::main] async fn main() -> Result<(), reqwest::Error> { let res = reqwest::Client::new() .get("https://hyper.rs") .send() …
semanser
  • 2,310
  • 2
  • 15
  • 33
4
votes
1 answer

Fastest way to send many groups of HTTP requests using new async/await syntax and control the amount of workers

Most recent threads I have read are saying async is the better way to perform lots of I/O bound work such as sending HTTP requests and the like. I have tried to pick up async recently but am struggling with understanding how to send many groups of…
PherdEye
  • 41
  • 2
4
votes
4 answers

Error "BlockingClientInFutureContext" when trying to make a request from within an actix-web route handler function

I am writing a web service with Rust 2018 Stable and Actix-Web. Using Reqwest, I am making an HTTP request to a diffent site from within one route handler function. Simplyfied it looks like this extern crate reqwest; use actix_web; use…
C14L
  • 12,153
  • 4
  • 39
  • 52
4
votes
1 answer

Attempting to import `reqwest::async` errors stating that `async` is a reserved keyword

I want to make asynchronous HTTP requests using the reqwest crate. I have the following code: // see https://docs.rs/reqwest/*/reqwest/async/index.html use reqwest::async::Client; When I attempt to compile my code I get the following error: error:…
taryn
  • 581
  • 8
  • 18
3
votes
1 answer

Why does a reqwest Response hang when switching WiFi networks on macOS / iOS?

I have constructed a proof-of-concept where tokio::io::copy will hang forever when switching between Cellular / WiFi / Wired networks if the reader is a reqwest::async_impl::Response wrapped in a tokio_io::AsyncRead using…
Erik Živković
  • 4,867
  • 2
  • 35
  • 53
1 2
3
14 15