Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebRequest

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

Hierarchy

  • WebRequest

Implements

Index

Properties

Static CustomRequestHeadersSearch playground for CustomRequestHeaders

CustomRequestHeaders: {}

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 CustomRequestModifiersSearch playground for CustomRequestModifiers

CustomRequestModifiers: ((request: XMLHttpRequest, url: string) => void)[]

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

Static SkipRequestModificationForBabylonCDNSearch playground for SkipRequestModificationForBabylonCDN

SkipRequestModificationForBabylonCDN: boolean

Accessors

onprogress

  • get onprogress(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null
  • set onprogress(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null): any
  • Gets or sets a function to be called when loading progress changes

    Returns ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null

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

    Parameters

    • value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null

    Returns any

readyState

  • get readyState(): number
  • Returns client's state

    Returns number

response

  • get response(): any
  • Returns client's response

    Returns any

responseText

  • get responseText(): string
  • Returns client's response as text

    Returns string

responseType

  • 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

  • get responseURL(): string
  • Returns client's response url

    Returns string

status

  • get status(): number
  • Returns client's status

    Returns number

statusText

  • get statusText(): string
  • Returns client's status as a text

    Returns string

timeout

  • get timeout(): number
  • set timeout(value: number): any
  • Gets or sets the timeout value in milliseconds

    Returns number

  • Gets or sets the timeout value in milliseconds

    Parameters

    • value: number

    Returns any

Methods

abortSearch playground for abort

  • abort(): void
  • Cancels any network activity

    Returns void

getResponseHeaderSearch playground for getResponseHeader

  • 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

openSearch playground for open

  • 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

sendSearch playground for send

  • send(body?: Document | XMLHttpRequestBodyInit | 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 | XMLHttpRequestBodyInit | null

      defines an optional request body

    Returns void

setRequestHeaderSearch playground for setRequestHeader

  • 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

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method