Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3765465
D3455.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3455.diff
View Options
diff --git a/ds-http-client/Cargo.toml b/ds-http-client/Cargo.toml
--- a/ds-http-client/Cargo.toml
+++ b/ds-http-client/Cargo.toml
@@ -2,6 +2,11 @@
name = "ds-http-client"
version = "0.1.0"
edition = "2021"
+description = "HTTP client to download files or query API with User-Agent set"
+authors = [
+ "Sébastien Santoro <dereckson@espace-win.org>"
+]
+license = "BSD-2-Clause"
[dependencies]
lazy_static = "~1.5.0"
diff --git a/ds-http-client/README.md b/ds-http-client/README.md
new file mode 100644
--- /dev/null
+++ b/ds-http-client/README.md
@@ -0,0 +1,34 @@
+# 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);
+ }
+ ```
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 12:29 (18 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257987
Default Alt Text
D3455.diff (1 KB)
Attached To
Mode
D3455: Document ds-http-client release
Attached
Detach File
Event Timeline
Log In to Comment