Make requests¶
fetch collects a response for scraping. It does not parse a page into a data model or run its JavaScript. Use a browser context when the request should represent a page's form, fetch(), or XHR; see browser contexts.
fetch defaults to GET. An explicit non-GET request without --request-kind is sent as an XHR from the target origin's root. --print-body prints to a terminal; redirecting stdout to a file prints the body without it.
The Go API requires a browser context for a non-GET with the shipped Chrome profiles. A nil Body means no body; a non-nil empty slice means an explicit zero-byte upload.
Response behaviour¶
The CLI can print a body, status and headers, or JSON Lines; see output and diagnostics. SDKs return a response object containing status, final URL, headers, cookies, text and raw body bytes. A non-2xx HTTP response is still a response; a DNS, TLS, transport, or execution failure is an error. SDK request methods do not provide the CLI's --wait-for or report writer: implement those application checks using the returned response.
Request URLs must be absolute HTTP or HTTPS URLs. The engine canonicalizes them using its browser URL rules and refuses unsupported input before sending it. --timeout and SDK timeouts bound the whole request, including redirects and body handling.