@launchdarkly/js-sdk-common
Version:
LaunchDarkly SDK for JavaScript - common code
23 lines • 1.16 kB
TypeScript
import { Encoding, HttpErrorResponse, Info } from '../api';
import { ApplicationTags } from '../options';
export type LDHeaders = {
authorization?: string;
'user-agent'?: string;
'x-launchdarkly-user-agent'?: string;
'x-launchdarkly-wrapper'?: string;
'x-launchdarkly-tags'?: string;
};
export declare function defaultHeaders(sdkKey: string, info: Info, tags?: ApplicationTags, includeAuthorizationHeader?: boolean, userAgentHeaderName?: 'user-agent' | 'x-launchdarkly-user-agent'): LDHeaders;
export declare function httpErrorMessage(err: HttpErrorResponse, context: string, retryMessage?: string): string;
export declare function shouldRetry({ status }: HttpErrorResponse): boolean;
/**
* In react-native use base64-js to polyfill btoa. This is safe
* because the react-native repo uses it too. Set the global.btoa to the encode
* function of base64-js.
* https://github.com/beatgammit/base64-js
* https://github.com/axios/axios/issues/2235#issuecomment-512204616
*
* Ripped from https://thewoods.blog/base64url/
*/
export declare const base64UrlEncode: (s: string, encoding: Encoding) => string;
//# sourceMappingURL=http.d.ts.map