tibber-api
Version:
Node.js module for connecting to Tibber API and extract data from your connected homes, including realtime data from Tibber Pulse.
31 lines (30 loc) • 1.16 kB
TypeScript
import { IConfig } from '../models/IConfig';
export declare class HeaderManager {
private static readonly DEFAULT_USER_AGENT;
private static readonly USER_AGENT_MAX_LENGTH;
private static _userAgent;
private _config;
/**
* Constructor
* Create an instance of TibberBase class
* @param {IConfig} config Config object
* @see IConfig
*/
constructor(config: IConfig);
/**
* Gets the User-Agent from apiEndpoint and ensures it is not changed once set.
*/
get userAgent(): string;
/**
* Sanitize User-Agent string.
* - Remove all characters that are not allowed in User-Agent.
* - Limit the length to 255 characters.
* @param {string} userAgent User-Agent string to sanitize.
* @returns {string} Sanitized User-Agent string.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent}
* @see {@link https://tools.ietf.org/html/rfc7231#section-5.5.3}
* @see {@link https://tools.ietf.org/html/rfc7230#section-3.2.6}
* @see {@link https://tools.ietf.org/html/rfc7230#section-5.5}
* */
private sanitizeUserAgent;
}