Skip to main content

Module fetch

Module fetch 

Source
Expand description

browser-control fetch — run an HTTP request from the page’s context.

The request is executed by injecting crate::dom::scripts::FETCH_JS into the active page via the engine-agnostic PageSession and parsing the {status, statusText, headers, body} envelope it returns.

Output mirrors curl:

  • --include prepends HTTP/1.1 <code> <text>\r\n and response headers.
  • --output PATH writes the body to PATH (and chmod 0600 on Unix).
  • Without --output, the body is written to stdout.

Transport errors (script failure, attach failure) exit non-zero; HTTP status is reported verbatim and does not change the exit code.

Functions§

run