Module: ol/http

ol/http


import * as olHttp from 'ol/http';

Functions

createImageLoadFunction(getHeaders, onError){function}

import {createImageLoadFunction} from 'ol/http';

Creates an imageLoadFunction (e.g. for ol/source/ImageStatic) that attaches the headers returned by the given function to the image requests. See load for details.

Name Type Description
getHeaders GetHeadersFn

Returns the headers to send for a URL.

onError OnErrorFn | null | undefined

Called when a request failed.

Returns:
The image load function.

createTileLoadFunction(getHeaders, onError){function}

import {createTileLoadFunction} from 'ol/http';

Creates a tileLoadFunction for image tile sources (e.g. ol/source/XYZ) that attaches the headers returned by the given function to the tile requests. The headers are requested per tile URL. See load for details.

Name Type Description
getHeaders GetHeadersFn

Returns the headers to send for a URL.

onError OnErrorFn | null | undefined

Called when a request failed.

Returns:
The tile load function.

Type Definitions

GetHeadersFn()

A function that returns the HTTP headers to send for the given URL, or null if no additional headers should be sent.

OnErrorFn()

A function that is called when a request has failed.