Optionalbody: NoInfer<BodyType> | nullOptionalinit: HttpResponseInitReadonly[bodyReadonlybodyReadonlybodyOptional ReadonlycfReadonlyheadersThe headers read-only property of the with the response.
ReadonlyokThe ok read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
ReadonlyredirectedThe redirected read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.
ReadonlystatusThe status read-only property of the Response interface contains the HTTP status codes of the response.
ReadonlystatusThe statusText read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
The type read-only property of the Response interface contains the type of the response.
ReadonlyurlThe url read-only property of the Response interface contains the URL of the response.
ReadonlywebStatic ReadonlySTATUS_Static ReadonlySTATUS_Response status codes for responses that cannot have body.
The clone() method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.
StaticarrayCreate a Response with an ArrayBuffer body.
Optionalbody: BodyTypeOptionalinit: HttpResponseInitStaticcloneSafely clones the given Response.
Coerces response clone exceptions into 500 mocked responses.
Handy in the environments that introduce arbitrary response
cloning restrictions, like "101 Switching Protocols" cloning
in "miniflare".
StaticerrorStaticformCreate a Response with a FormData body.
Optionalbody: FormDataOptionalinit: HttpResponseInitStatichtmlCreate a Response with a Content-Type: "text/html" body.
Optionalbody: BodyType | nullOptionalinit: HttpResponseInitStaticisStaticisStaticisReturns a boolean indicating whether the given response status code represents a response that can have a body.
StaticjsonCreate a Response with a Content-Type: "application/json" body.
Optionalbody: NoInfer<BodyType> | nullOptionalinit: HttpResponseInitStaticparseParses the given raw HTTP headers into a Fetch API Headers instance.
StaticredirectOptionalstatus: numberStaticsetStatictextCreate a Response with a Content-Type: "text/plain" body.
Optionalbody: NoInfer<BodyType> | nullOptionalinit: HttpResponseInitStaticxmlCreate a Response with a Content-Type: "application/xml" body.
Optionalbody: BodyType | nullOptionalinit: HttpResponseInit
A drop-in replacement for the standard
Responseclass to allow additional features, like mocking the responseSet-Cookieheader.Example
See
HttpResponseAPI reference