Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MockXMLHttpRequest

Hierarchy

  • MockXMLHttpRequest

Index

Properties

body

body: any

listeners

listeners: { error?: (event: ErrorEvent) => void; load?: () => void; progress?: (event: ProgressEvent) => void; uploadProgress?: (event: ProgressEvent) => void }

Type declaration

  • Optional error?: (event: ErrorEvent) => void
      • (event: ErrorEvent): void
      • Parameters

        • event: ErrorEvent

        Returns void

  • Optional load?: () => void
      • (): void
      • Returns void

  • Optional progress?: (event: ProgressEvent) => void
      • (event: ProgressEvent): void
      • Parameters

        • event: ProgressEvent

        Returns void

  • Optional uploadProgress?: (event: ProgressEvent) => void
      • (event: ProgressEvent): void
      • Parameters

        • event: ProgressEvent

        Returns void

method

method: string

mockAborted

mockAborted: boolean = false

mockHeaders

mockHeaders: {}

Type declaration

  • [key: string]: string

mockResponseHeaders

mockResponseHeaders: string = ""

response

response: any | undefined = undefined

responseText

responseText: string | undefined = undefined

responseType

responseType: string = "text"

responseURL

responseURL: string | null = null

status

status: number = 0

statusText

statusText: string = ""

upload

upload: MockXMLHttpRequestUpload = new MockXMLHttpRequestUpload(this)

url

url: string

withCredentials

withCredentials: boolean = false

Methods

abort

  • abort(): void

addEventListener

  • addEventListener(event: "error" | "load" | "progress" | "uploadProgress", handler: Function): void
  • Parameters

    • event: "error" | "load" | "progress" | "uploadProgress"
    • handler: Function

    Returns void

getAllResponseHeaders

  • getAllResponseHeaders(): string

getResponseHeader

  • getResponseHeader(header: string): string | null

mockDownloadProgressEvent

  • mockDownloadProgressEvent(loaded: number, total?: number): void

mockErrorEvent

  • mockErrorEvent(error: any): void

mockFlush

  • mockFlush(status: number, statusText: string, body?: string): void
  • Parameters

    • status: number
    • statusText: string
    • Optional body: string

    Returns void

mockLoadEvent

  • mockLoadEvent(): void

mockUploadProgressEvent

  • mockUploadProgressEvent(loaded: number, total?: number): void

open

  • open(method: string, url: string): void

removeEventListener

  • removeEventListener(event: "error" | "load" | "progress" | "uploadProgress"): void
  • Parameters

    • event: "error" | "load" | "progress" | "uploadProgress"

    Returns void

send

  • send(body: any): void

setRequestHeader

  • setRequestHeader(name: string, value: string): void

Generated using TypeDoc