WebRequest

Extended version of XMLHttpRequest with support for customizations (headers, ...)

Hierarchy

  • WebRequest

Implements

Index

Properties

onprogress

Find examples in Playground
onprogress: function | null

Gets or sets a function to be called when loading progress changes

readyState

Find examples in Playground
readyState: number

Returns client's state

response

Find examples in Playground
response: any

Returns client's response

responseText

Find examples in Playground
responseText: string

Returns client's response as text

responseType

Find examples in Playground
responseType: XMLHttpRequestResponseType

Gets or sets the expected response type

responseURL

Find examples in Playground
responseURL: string

Returns client's response url

status

Find examples in Playground
status: number

Returns client's status

statusText

Find examples in Playground
statusText: string

Returns client's status as a text

Static CustomRequestHeaders

Find examples in Playground
CustomRequestHeaders: object

Custom HTTP Request Headers to be sent with XMLHttpRequests i.e. when loading files, where the server/service expects an Authorization header

Type declaration

  • [key: string]: string

Static CustomRequestModifiers

Find examples in Playground
CustomRequestModifiers: function[]

Add callback functions in this array to update all the requests before they get sent to the network

Methods

abort

Find examples in Playground
  • abort(): void
  • Cancels any network activity

    Returns void

getResponseHeader

Find examples in Playground
  • getResponseHeader(name: string): Nullable<string>
  • Get the string containing the text of a particular header's value.

    Parameters

    • name: string

      The name of the header

    Returns Nullable<string>

    The string containing the text of the given header name

open

Find examples in Playground
  • open(method: string, url: string): void
  • Sets the request method, request URL

    Parameters

    • method: string

      defines the method to use (GET, POST, etc..)

    • url: string

      defines the url to connect with

    Returns void

send

Find examples in Playground
  • send(body?: Document | BodyInit | null): void
  • Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD

    Parameters

    • Optional body: Document | BodyInit | null

      defines an optional request body

    Returns void

setRequestHeader

Find examples in Playground
  • setRequestHeader(name: string, value: string): void
  • Sets the value of a request header.

    Parameters

    • name: string

      The name of the header whose value is to be set

    • value: string

      The value to set as the body of the header

    Returns void

Generated using TypeDoc