UNPKG

@villedemontreal/http-request

Version:

HTTP utilities - send HTTP requests with proper headers, etc.

63 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.configs = exports.Configs = void 0; const _ = require("lodash"); /** * Http Client Config */ class Configs { /** * Sets the Logger creator. */ setLoggerCreator(loggerCreator) { this._loggerCreator = loggerCreator; } /** * The Logger creator */ get loggerCreator() { if (!this._loggerCreator) { throw new Error(`The Logger Creator HAS to be set as a configuration! Please call the init(...) function first.`); } return this._loggerCreator; } /** * Sets the Correlation Id provider. */ setCorrelationIdProvider(correlationIdProvider) { this._correlationIdProvider = correlationIdProvider; } /** * The Correlation Id provider */ get correlationIdProvider() { if (!this._correlationIdProvider) { throw new Error(`The Correlation Id provider HAS to be set as a configuration! Please call the init(...) function first.`); } return this._correlationIdProvider; } /** * The current Correlation Id. */ get correlationId() { return this.correlationIdProvider(); } /** * Sets the case sensitivity to use for the URLs. */ setUrlCaseSensitive(urlCaseSensitive) { this._urlCaseSensitive = urlCaseSensitive; } /** * Routing info */ get isUrlCaseSensitive() { if (_.isNil(this._urlCaseSensitive)) { throw new Error(`The Case Sensitivity to use for the URLs HAS to be set as a configuration! Please call the init(...) function first.`); } return this._urlCaseSensitive; } } exports.Configs = Configs; exports.configs = new Configs(); //# sourceMappingURL=configs.js.map