@node-ntlm/httpreq
Version:
NTLM httpreq node utility function
45 lines (44 loc) • 1.76 kB
TypeScript
/// <reference types="node" />
declare interface HttpReqOptions {
readonly parameters?: Record<string, unknown>;
readonly json?: boolean;
readonly files?: Record<string, unknown>;
readonly body?: unknown;
readonly headers?: Record<string, unknown>;
readonly cookies?: ReadonlyArray<string>;
readonly auth?: unknown;
readonly binary?: boolean;
readonly allowRedirects?: boolean;
readonly maxRedirects?: number;
readonly encodePostParameters?: boolean;
readonly timeout?: number;
readonly proxy?: unknown;
readonly host?: string;
readonly port?: number;
readonly protocol?: 'http' | 'https';
readonly rejectUnauthorized?: boolean;
}
interface Options extends HttpReqOptions {
readonly url: string;
readonly username: string;
readonly password: string;
readonly workstation?: string;
readonly domain?: string;
readonly lm_password?: Buffer;
readonly nt_password?: Buffer;
readonly [key: string]: unknown;
}
interface Result {
headers: Record<string, string>;
body: unknown;
statusCode: number;
[key: string]: any;
}
export declare function method<T extends Result>(stringMethod: 'get' | 'put' | 'patch' | 'post' | 'delete' | 'options', options: Options): Promise<T>;
export declare function get<T extends Result>(options: Options): Promise<T>;
export declare function put<T extends Result>(options: Options): Promise<T>;
export declare function patch<T extends Result>(options: Options): Promise<T>;
export declare function post<T extends Result>(options: Options): Promise<T>;
export declare function del<T extends Result>(options: Options): Promise<T>;
export declare function options<T extends Result>(options: Options): Promise<T>;
export {};