WebRequest

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

Hierarchy

  • WebRequest

Implements

Index

Properties

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

Accessors

onprogress

Find examples in Playground
  • get onprogress(): function | null
  • set onprogress(value: function | null): any
  • Gets or sets a function to be called when loading progress changes

    Returns function | null

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

    Parameters

    • value: function | null

    Returns any

readyState

Find examples in Playground
  • get readyState(): number
  • Returns client's state

    Returns number

response

Find examples in Playground
  • get response(): any
  • Returns client's response

    Returns any

responseText

Find examples in Playground
  • get responseText(): string
  • Returns client's response as text

    Returns string

responseType

Find examples in Playground
  • get responseType(): XMLHttpRequestResponseType
  • set responseType(value: XMLHttpRequestResponseType): any
  • Gets or sets the expected response type

    Returns XMLHttpRequestResponseType

  • Gets or sets the expected response type

    Parameters

    • value: XMLHttpRequestResponseType

    Returns any

responseURL

Find examples in Playground
  • get responseURL(): string
  • Returns client's response url

    Returns string

status

Find examples in Playground
  • get status(): number
  • Returns client's status

    Returns number

statusText

Find examples in Playground
  • get statusText(): string
  • Returns client's status as a text

    Returns string

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