Skip to content

HttpResponse

What httpRequest returns. Every status the server sent comes back here, including 4xx and 5xx, so check ok or status instead of catching.

Properties

Property Type Description
data unknown The parsed body, or undefined if there was none. It is unknown because a failed call returns an error payload rather than what you asked for. Check ok, then narrow it.
headers Record<string, string> Response headers. Names are lowercased.
ok boolean True when the status is 200–299.
redirected boolean Whether the request was redirected. Often the reason an API returns 200 with HTML.
status number Response status code.
statusText string The status text. Empty on HTTP/2, which does not send one.
url string The URL the response came from, after any redirects.