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
3
votes
1 answer

Calling async reqwest from with actix-web

In my actix-web-server, I'm trying to use reqwest to call an external server, and then return the response back to the user. use actix_web::{web, App, HttpResponse, HttpServer, Responder}; use serde::{Deserialize, Serialize}; use…
Letharion
  • 4,067
  • 7
  • 31
  • 42
3
votes
1 answer

Why isn't reqwest returning the content length in this request?

I'm confused why I'm not getting any content back from the following function, which uses reqwest: fn try_get() { let wc = reqwest::Client::new(); wc.get("https://httpbin.org/json").send().map(|res| { println!("{:?}", res); …
user8370684
2
votes
0 answers

Parse multipart/form-data response in rust / reqwest

I'm relatively new to rust and using reqwest to fetch a PDF document from a REST API endpoint. The content-type of the response is multipart/form-data; boundary=bc1f6465-6738-4b46-9d9d-b9ae36afa8cb with two…
pfust75
  • 401
  • 1
  • 5
  • 17
2
votes
1 answer

Elegant way to unwrap the result of reqwest::get.text

I needed to read a simple text data from API using reqwest::get, so I've implemented the following: #[tokio::main] async fn process_api() { let response_text = reqwest::get("https://httpbin.org/anything") .await.unwrap().text() …
Enigo
  • 3,685
  • 5
  • 29
  • 54
2
votes
0 answers

Failed custom build command using Cargo when including reqwest with rustls-tls in redhat 6

in my Cargo.toml reqwest = { version = "0.10", default-features = false, features = ["blocking", "json", "rustls-tls"] } my rust version is 1.59 matched the glibc 2.15 in redhat 6 when I run cargo check , the errors below: Checking http-body…
Yi Peng
  • 21
  • 2
2
votes
2 answers

Build query string with param having multiple values for a reqwest Client

I'm trying to build a query string for reqwest Client using the builder's query() method. But one of the parameters has to be multiple values encoded like this ?dt=t&dt=at&dt=m I can't figure out how. use reqwest::blocking::Client; use…
JBart
  • 93
  • 1
  • 8
2
votes
1 answer

How to handle nested JSON objects in reqwest?

I am using reqwest to perform a GET request from https://httpbin.org. Performing a request to a one-level json endpoint like https://httpbin.org/ip is easy use std::collections::HashMap; fn main() { let body =…
Pro Poop
  • 357
  • 5
  • 14
2
votes
1 answer

How to write a test for reqwest?

I want to make a request in some API, so I made this: pub fn address_by_alias(node_url: &str, alias: &str) -> Result<(), Box> { let full_url = format!("{}/addresses/alias/by-alias/{}", node_url, alias); let response =…
2
votes
0 answers

Gzip response is not decompressed

I am trying to decompress a gzipped response. reqwest has a client builder flag that enables decompressing with features flag gzip. I am using async client with tokio runtime. //Cargo.toml reqwest = { version = "0.11.8", features = ["gzip"]…
katrocitus
  • 45
  • 1
  • 6
2
votes
2 answers

Trouble with reqwest: Unable to deserialize JSON response + `match` issues

I am learning Rust and it's web api support. I am working on a simple project which does a web API call. Here's the intuition: (It's all about getting Sprint dates from an Azure DevOps project) In src/getlatestsprint.rs I have a struct that has…
Anonymous Person
  • 1,437
  • 8
  • 26
  • 47
2
votes
0 answers

error trying to connect: the certificate was not trusted

I am running docker container which contains REST API with tls enable, For which I am passing self signed .pem certificate and I am using reqwest crate to call the REST API. If tls is disable with container it works well. But when I run container…
nagaraj
  • 797
  • 1
  • 6
  • 29
2
votes
1 answer

How do you issue a GET request and print the results?

I'd like to to pass a https string with an api key to Rust and print out the results of the GET request. #[macro_use] extern crate serde_json; extern crate reqwest; use reqwest::Error; use std::future::Future; #[derive(Debug)] fn main() ->…
marrowgari
  • 417
  • 3
  • 15
2
votes
2 answers

Minimal Docker for Networking Rust Binary

I have a Rust binary I want to put in a docker image. To minimize the image size, I used http://github.com/larsks/dockerize/ which adds libc and a few nss library files. However it's failing to resolve DNS and I want to know what's the hidden system…
mq7
  • 1,125
  • 2
  • 11
  • 21
2
votes
1 answer

How do I generify the error of a Rust Result to Result>?

I am trying to generify a Result that is returned by the reqwest::blocking::get function. It returns a Result but the function it is called in returns a Result
Dan
  • 5,013
  • 5
  • 33
  • 59
2
votes
1 answer

How do I send request without await?

I am using reqwest, and am trying to send a request every 97 ms. But, I do not want to have to wait for the last request to happen or for it to be read. I just want a request to send every 97 ms and to be sending the output at all times to…
ocean moist
  • 310
  • 1
  • 10