#http #https #client #request


Simple, minimal-dependency HTTP client

9 releases (stable)

✓ Uses Rust 2018 edition

new 1.1.2 Apr 14, 2019
1.1.1 Mar 28, 2019
1.0.3 Jul 30, 2018
1.0.2 Mar 18, 2018
0.1.2 Mar 18, 2018

#28 in HTTP client

Download history 5/week @ 2018-12-30 15/week @ 2019-01-06 7/week @ 2019-01-13 39/week @ 2019-01-20 23/week @ 2019-01-27 27/week @ 2019-02-03 33/week @ 2019-02-10 46/week @ 2019-02-17 49/week @ 2019-02-24 76/week @ 2019-03-03 119/week @ 2019-03-10 83/week @ 2019-03-17 265/week @ 2019-03-24 83/week @ 2019-03-31 96/week @ 2019-04-07

319 downloads per month
Used in 2 crates (1 directly)

ISC license

383 lines


Crates.io Documentation CI

Simple, minimal-dependency HTTP client.



This crate is distributed under the terms of the ISC license.



Simple, minimal-dependency HTTP client. The library has a very minimal API, so you'll probably know everything you need to after reading a few examples.


Since the crate is supposed to be minimal in terms of dependencies, HTTPS is a feature on its own, as it requires the (very good) rustls crate. To be able to send HTTPS requests, you need to change your Cargo.toml's [dependencies] part to something like the following:

minreq = { version = "1.0.0", features = ["https"] }



// This is a simple example of sending a GET request and
// printing out the response.
if let Ok(response) = minreq::get("http://httpbin.org/ip").send() {
    println!("{}", response.body);


// To include a body, add .with_body("") before .send().
if let Ok(response) = minreq::post("http://httpbin.org/post")
    println!("{}", response.body);


// To add a header, add .with_header("Key", "Value") before .send().
if let Ok(response) = minreq::get("http://httpbin.org/headers")
    .with_header("Accept", "text/plain")
    .with_header("Something", "Interesting")
    println!("{}", response.body);


// To avoid timing out, or limit the request's response time even more,
// use .with_timeout(n) before .send(). The given value is in seconds.
// NOTE: There is no timeout by default.
if let Ok(response) = minreq::post("http://httpbin.org/delay/6")
    println!("{}", response.body);


By default, a request has no timeout. You can change this in two ways:

  • Use this function (create_request) and call with_timeout on it to set the timeout per-request like so:
  • Set the environment variable MINREQ_TIMEOUT to the desired amount of seconds until timeout. Ie. if you have a program called foo that uses minreq, and you want all the requests made by that program to timeout in 8 seconds, you launch the program like so:
    $ MINREQ_TIMEOUT=8 ./foo
    Or add the following somewhere before the requests in the code.
    use std::env;
    env::set_var("MINREQ_TIMEOUT", "8");


~39K SLoC