#http #https #client #request


Simple, minimal-dependency HTTP client

10 stable releases

✓ Uses Rust 2018 edition

1.3.0 Jun 4, 2019
1.2.1 May 24, 2019
1.1.2 Apr 14, 2019
1.1.1 Mar 28, 2019
0.1.2 Mar 18, 2018

#24 in HTTP client

Download history 30/week @ 2019-02-19 74/week @ 2019-02-26 82/week @ 2019-03-05 102/week @ 2019-03-12 140/week @ 2019-03-19 202/week @ 2019-03-26 92/week @ 2019-04-02 116/week @ 2019-04-09 51/week @ 2019-04-16 31/week @ 2019-04-23 28/week @ 2019-04-30 45/week @ 2019-05-07 33/week @ 2019-05-14 100/week @ 2019-05-21 96/week @ 2019-05-28

377 downloads per month
Used in 4 crates (3 directly)

ISC license

445 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 = "*", 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