Module zng_task::http

source ·
Expand description

HTTP client.

This module is a thin wrapper around the isahc crate that just limits the API surface to only async methods without the async suffix. You can convert from/into that isahc types and this one.

§Examples

Get some text:

let text = task::http::get_text("https://httpbin.org/base64/SGVsbG8gV29ybGQ=").await?;
println!("{text}!");

Modules§

  • HTTP header types
  • URI component of request and response lines

Structs§

Enums§

  • Cache mode selected for a Uri.
  • An error encountered while sending an HTTP request or receiving an HTTP response using a Client.
  • Describes a policy for handling server redirects.

Traits§

Functions§

  • The Client used by the functions in this module.
  • Send a DELETE request to the uri.
  • Send a GET request to the uri.
  • Send a GET request to the uri and read the response as raw bytes.
  • Send a GET request to the uri and de-serializes the response.
  • Send a GET request to the uri and read the response as a string.
  • Send a HEAD request to the uri.
  • Send a POST request to the uri with a given request body.
  • Send a PUT request to the uri with a given request body.
  • Send a custom Request.
  • Set a custom initialization function for the default_client.

Type Aliases§