nyro
Version:
A simple and effective promise-based HTTP & HTTP/2 request library that supports all HTTP methods.
35 lines (34 loc) • 1.39 kB
TypeScript
import { Headers as HeadersInterface } from './engine';
export default class Headers {
private headers;
constructor(headers?: HeadersInterface);
toJSON(): {
[key: string]: string;
};
set(key: (keyof HeadersInterface & string), value: string): this;
get(key: (keyof HeadersInterface & string)): string | undefined;
delete(key: (keyof HeadersInterface & string)): this;
all(): HeadersInterface;
clear(): this;
has(key: (keyof HeadersInterface & string)): boolean;
setFromObject(headers: HeadersInterface): this;
setFromHeaders(headers: Headers): this;
setUserAgent(userAgent: string): this;
setContentType(contentType: string): this;
setAccept(accept: string): this;
setAuthorization(authorization: string): this;
setBearerToken(token: string): this;
setBasicAuth(username: string, password: string): this;
setBearerAuth(token: string): this;
setReferer(referer: string): this;
setOrigin(origin: string): this;
setHost(host: string): this;
setConnection(connection: string): this;
setAcceptEncoding(acceptEncoding: string): this;
setAcceptLanguage(acceptLanguage: string): this;
setResponseType(responseType: string): this;
setCacheControl(cacheControl: string): this;
setCookie(cookie: string): this;
setDNT(dnt: string): this;
setPragma(pragma: string): this;
}