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§

header

Structs§

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

Enums§

Kind
Specifies the type of error
Method
Specify the HTTP method to use
Proxy
Instead of connecting directly to the host, connect via this proxy

Functions§

get
Make a basic http GET request to the given URL
init
Initializes the underlying libcurl library.
post
Sends an http POST request to the given URL.
put
Sends an http PUT request to the given URL.

Type Aliases§

Result