On this page

Type Alias RequestParameters

A RequestParameters object to be returned from Map.options.transformRequest callbacks.

// use transformRequest to modify requests that begin with `http://myHost`
transformRequest: function(url, resourceType) {
 if (resourceType === 'Source' && url.indexOf('http://myHost') > -1) {
   return {
     url: url.replace('http', 'https'),
     headers: { 'my-custom-header': true },
     credentials: 'include'  // Include cookies for cross-origin requests
   }
  }
}
type RequestParameters = {
    body?: string;
    cache?: RequestCache;
    collectResourceTiming?: boolean;
    credentials?: "same-origin" | "include";
    headers?: any;
    method?: "GET" | "POST" | "PUT";
    referrerPolicy?: ReferrerPolicy;
    type?: "string" | "json" | "arrayBuffer" | "image";
    url: string;
}
Index

Properties

body?: string

Request body.

cache?: RequestCache

Parameters supported only by browser fetch API. Property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache. (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache)

collectResourceTiming?: boolean

If true, Resource Timing API information will be collected for these transformed requests and returned in a resourceTiming property of relevant data events.

credentials?: "same-origin" | "include"

'same-origin'|'include' Use 'include' to send cookies with cross-origin requests.

headers?: any

The headers to be sent with the request.

method?: "GET" | "POST" | "PUT"

Request method 'GET' | 'POST' | 'PUT'.

referrerPolicy?: ReferrerPolicy

The referrer policy to use for the request. Controls how much referrer information is sent. (https://developer.mozilla.org/en-US/docs/Web/API/Request/referrerPolicy)

type?: "string" | "json" | "arrayBuffer" | "image"

Response body type to be returned.

url: string

The URL to be requested.

Was this helpful?
SDK JS
Reference
RequestParameters