Skip to main content

Module fetch

Module fetch 

Source
Expand description

HTTP fetch with a hard body cap and a fixed timeout.

Constants:

  • DEFAULT_TIMEOUT_SECS — request timeout (currently 15 s).
  • MAX_BODY_BYTES — hard cap on response size (currently 2 MiB).
  • USER_AGENT — sent as User-Agent header; format is agentsec/<cargo-pkg-version>.

Non-2xx responses and oversized bodies are rejected via crate::Error::Sanitize. The body is not truncated; the request is failed.

Functions§

get
Fetch a URL with a 2 MiB body cap and a 15 s timeout.