Crate idcurl

source ·
Expand description

An idiomatic synchronous Rust library for making HTTP requests.

It’s implemented in terms of curl.

§Example

let mut output = vec!();
idcurl::get("http://example.com")
    .expect("error making request")
    .copy_to(&mut output)
    .unwrap();
let body = r#"{ "hello": "world" }"#;

let mut response = idcurl::Request::post(
    "http://example.com".to_string()
)
    .header("Content-Type", "application/json")
    .body(std::io::Cursor::new(body))
    .send()
    .expect("http request");
assert!(response.status().is_success());
std::io::copy(&mut response, &mut std::io::stdout())
    .expect("reading response");

Modules§

Structs§

  • A possible error value when converting a StatusCode from a u16 or &str
  • Represent an unsent query.
  • Represents the result of an HTTP request
  • An HTTP status code (status-code in RFC 7230 et al.).

Enums§

  • Specifies the type of error
  • Specify the HTTP method to use

Functions§

  • Make a basic http GET request to the given URL
  • Initializes the underlying libcurl library.
  • Sends an http POST request to the given URL.
  • Sends an http PUT request to the given URL.

Type Aliases§