Hierarchy

Properties

Optional body

body: string | FormData | ArrayBuffer

Body of the request.

Optional Readonly fragment

fragment: undefined | string

Additional part of the URL path to the API method.

Optional headers

headers: Record<string, string>

Headers.

Readonly host

host: string

Domain or IP address of the request.

Optional method

method: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "OPTIONS" | string

HTTP request method.

The default method GET is used.

Readonly path

path: string

Relative path to the URL API method.

Optional Readonly port

port: undefined | number

Request port.

Optional query

Parameters of the URL string for a query.

To form a web request for the address https://yandex.ru/search/ ?text=elma365, do the following:

const result = await  fetch('https://yandex.ru/search/', {
  query: { 'text': 'elma365' } 
});  

Existing parameters in the address will be united with whatever is specified in query.

Readonly scheme

scheme: string

Request protocol.