ds-http-client 0.1.0

HTTP client to download files or query API with User-Agent set
Documentation
  • Coverage
  • 46.15%
    6 out of 13 items documented0 out of 10 items with examples
  • Size
  • Source code size: 50.12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.56 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 2s Average build duration of successful builds.
  • all releases: 1m 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • dereckson

HTTP client for Nasqueron Datasources components

The crate ds-http-client is a HTTP client based on Hyper / reqwest components.

It can be used to download a file on an HTTP server, or query an API with User-Agent header.

Usage example

Initialize a client

```
use ds_http_client::Client;

let mut headers = HashMap::new();
headers.insert(
    "User-Agent".to_string(),
    "foo/1.2.3".to_string(),
);

let client = Client::new(Some(headers));
```

Download a file

```
let url = "http://www.example.com/example.tar.gz";
let target_path = "/tmp/example.tar.gz";

if let Err(error) = client().download(&url, &target_path).await {
    eprintln!("Can't download file: {:?}", error);
}
```