baml.http.fetch

Sends a GET request to `url` and returns the response.

Reference version

Signature

function baml.http.fetch(
url: string,
timeout: baml.time.Duration | null = …

Sends a GET request to url and returns the response.

timeout is the end-to-end limit for the request: connecting, waiting for response headers and reading the body. null (the default) is 5 minutes; a zero or negative duration is no limit. Connecting is also limited to 10 seconds; use send with a Request to change that. On expiry this throws baml.errors.Timeout, whose timeout_type is "timeout" or "connect_timeout".

Source:<builtin>/baml/ns_http/http.bamlbytes 8991–9392