Expand description
HTTP client.
This module provides an HTTP client API that is backend agnostic. By default it uses the system curl command
line utility with a simple cache, this can be replaced using the full API.
§Examples
Get some text:
let text = task::http::get_txt("https://httpbin.org/base64/SGVsbG8gV29ybGQ=").await?;
println!("{text}!");§Full API
See zng_task::http for the full API.
Modules§
Structs§
- Method
- The Request Method (VERB)
- Request
- HTTP request.
- Response
- HTTP response.
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.). - Uri
- The URI component of a request.
Functions§
- cache_
clean - Remove all cached entries, or just older ones if
pruneis enabled. - delete
- Send a DELETE request to the
uri. - get
- Send a GET request to the
uri. - get_
bytes - Send a GET request to the
uriand read the response as raw bytes. - get_
json - Send a GET request to the
uriand de-serializes the response. - get_txt
- Send a GET request to the
uriand read the response as a string. - head
- Send a HEAD request to the
uri. - post
- Send a POST request to the
uriwith a given request body. - put
- Send a PUT request to the
uriwith a given request body. - send
- Send a custom
Request. - set_
request_ default - Set the default values returned by
Request::new.
Type Aliases§
- Error
- Any error during request or response.