Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Request<T>

General request object whose properties is common in both XMLHttpRequest and fetch.

Type parameters

  • T: "xhr" | "fetch"

Hierarchy

Index

Properties

ajaxType

ajaxType: T

"xhr" or "fetch".

When a request is generated by XMLHttpRequest, then ajaxType is "xhr".

When a request is generated by window.fetch, then ajaxType is "fetch".

Optional body

body: T extends "xhr" ? BodyInit | null | Document : BodyInit | null

A request body.

BodyInit: Blob | BufferSource | FormData | URLSearchParams | ReadableStream<Uint8Array> | string

headers

headers: Record<string, string>

Key-value pairs of a header.

example
var request = {
  headers: {
    "Content-Type": "text/html",
    "Authorization": "xxxxxxx"
  }
};

method

method: string

Http method like GET, POST and so on.

timeout

timeout: number

timeout is only used by XMLHttpRequest.

url

url: string

Request url to send request.

Generated using TypeDoc