@libp2p/http
    Preparing search index...

    Extends the native Response class to be more flexible.

    • response headers - the fetch spec restricts access to certain headers that we need access to set-cookie, Access-Control-*, etc, and the native Response implementations remove them

    • status codes - we need to represent all possible HTTP status codes, not just those allowed by the fetch spec

    Hierarchy

    Index

    Constructors

    Properties

    bodyUsed: boolean
    headers: Headers

    The headers read-only property of the Response interface contains the Headers object associated with the response.

    MDN Reference

    ok: boolean

    The 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.

    MDN Reference

    redirected: boolean

    The 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.

    MDN Reference

    status: number

    The status read-only property of the Response interface contains the HTTP status codes of the response.

    MDN Reference

    statusText: string

    The statusText read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.

    MDN Reference

    type: ResponseType

    The type read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers.

    MDN Reference

    url: string

    The url read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects.

    MDN Reference

    Methods

    • The clone() method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.

      MDN Reference

      Returns Response

    • The clone() method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.

      MDN Reference

      Returns Response

    • Returns Promise<any>

    • Returns Promise<any>

    • Returns Promise<string>

    • Returns Promise<string>

    • The error() static method of the Response interface returns a new Response object associated with a network error.

      MDN Reference

      Returns Response

    • The json() static method of the Response interface returns a Response that contains the provided JSON data as body, and a Content-Type header which is set to application/json. The response status, status message, and additional headers can also be set.

      MDN Reference

      Parameters

      • data: any
      • Optionalinit: ResponseInit

      Returns Response

    • The redirect() static method of the Response interface returns a Response resulting in a redirect to the specified URL.

      MDN Reference

      Parameters

      • url: string | URL
      • Optionalstatus: number

      Returns Response