Skip to content

Function: httpProvider() ​

ts
function httpProvider(options): ConfigProvider;

Defined in: providers/http.ts:45

Create a provider that gets the configuration document from an HTTP endpoint.

Parameters ​

ParameterTypeDescription
optionsHttpProviderOptionsThe URL, the headers, the poll interval and the save method.

Returns ​

ConfigProvider

A provider that can load and, as configured, save and subscribe.

Remarks ​

A poll sends If-None-Match with the last ETag. The status 304 means no change. The provider does not poll while document.hidden is true. A status that is not 2xx makes the request reject. A poll that fails keeps the last document, sends the error to the subscriber and tries again after pollMs.

Example ​

ts
httpProvider({ url: '/api/wand', pollMs: 30_000, save: 'PUT' });