Skip to main content

Module http

Module http 

Source
Expand description

Client: the reqwest-backed Transport (feature http).

It applies the same policy as the GCS store: HTTPS only (loopback http for emulators and tests), redirects refused, bounded bodies, bearer tokens from any TokenProvider (plus the quota-project header for user credentials), and jittered exponential backoff that honours Retry-After. One client holds one connection pool; with HTTP/2 many concurrent calls share a connection.

use objstore_r::transport::{Request, Transport};
use objstore_r::{http::Client, token::Adc, Bytes};

let client = Client::new(Adc::discover()?, Default::default())?;
let url = "https://us-central1-aiplatform.googleapis.com/v1/projects/p/locations/us-central1/publishers/google/models/m:generateContent";
let resp = client.send(Request::post_json(url, Bytes::from_static(b"{}"))).await?.error_for_status()?;

Structs§

Chunks
A bounded chunked body. Dropping it aborts the transfer.
Client
An authorised HTTPS client. See the module docs.
HttpConfig
Settings.

Functions§

block_on
Run fut to completion on a single-threaded runtime driving this transport’s I/O and timers — for command-line tools with a synchronous main. Libraries should stay runtime-agnostic and leave this to the binary. Fails only if the runtime cannot start.