Skip to content

rust-fetchfetch() plus the policy production code needs

Timeouts, retries, typed errors, streaming and security limits, from one Rust core that behaves the same in browsers, Web Workers and Node.js.

js
import { WasmClient } from 'rust-fetch';

const api = new WasmClient({
  baseUrl: 'https://api.example.com/v1',
  timeoutMs: 10_000, // per attempt, including reading the body
  retries: 3,        // exponential backoff with jitter; honours Retry-After
});

try {
  const { body: user } = await api.get('/users/42');
} catch (error) {
  if (error.kind === 'HttpError' && error.status === 404) {
    // not found: error.body has the response text
  } else {
    throw error;
  }
}

Released under the MIT or Apache-2.0 license.