Optional
bodyThe body of the request, as a string, if present.
May be left as any falsy value if no body was present (e.g. null
, undefined
, ''
, etc.).
Do not attempt to parse the body or convert it to a different format. Simply return it as a string.
For example, use await resp.text()
, not await resp.json()
.
resp.text()
generally returns an empty string if the body is empty, so it's perfectly safe to use.Optional
extraAn optional object that may contain any extra debugging information you want to include.
stdout/stderr
LoggingOutput.event
output.Note that the final extraLogInfo
object may contain other fields as well, depending on what method was used.
collection.insertMany
may set a records
and ordered
field in extraLogInfo
.The response headers, formatted as a plain old JavaScript object.
Ensure that the headers are correctly normalized into a plain object. They should not be returned as a Headers
object or similar.
You may need to do something like the following:
const headers = Object.fromEntries(resp.headers.entries());
// or
const headers = {} as Record<string, string>;
resp.headers.forEach((value, key) => {
headers[key] = value;
});
The HTTP version used for the request.
Possible values:
1
→ HTTP/1.12
→ HTTP/2Ensure that this matches the forceHttp1
flag in FetcherRequestInfo
if applicable.
This is just used for debugging purposes.
The exact HTTP status code of the response.
200
, 404
, 500
Do not throw an error on non-2xx status codes. The response should be returned as-is.
Catch any HTTP error thrown if necessary, and return it as a response.
Otherwise, see if your fetch implementation has a way to disable error-ing on non-2xx status codes.
For example, with axios
, you can set validateStatus: () => true
to disable this behavior.
The status text of the response.
"OK"
, "Not Found"
, "Internal Server Error"
status
code.This is just used for debugging purposes.
The URL to which the request was made.
This may be different from the original URL if the request was redirected.
This is just used for debugging purposes.
Overview
Represents the response information returned from a request made by a Fetcher.
Key points of note
extraLogInfo
.See