UNPKG

nyro

Version:

A simple and effective promise-based HTTP & HTTP/2 request library that supports all HTTP methods.

32 lines (31 loc) 1.57 kB
import { RequestOptions as RequestInterface, Headers as HeadersInterface, AuthOptions as AuthInterface, ProxyOptions as ProxyInterface } from './engine'; import { ResponseEncoding } from '../helpers/types'; export default class Options { private options; constructor(options?: RequestInterface); toJSON(): RequestInterface; set(key: (keyof RequestInterface & string), value: any): this; get(key: (keyof RequestInterface & string)): any | undefined; delete(key: (keyof RequestInterface & string)): this; all(): RequestInterface; clear(): this; has(key: (keyof RequestInterface & string)): boolean; setFromObject(options: RequestInterface): this; setFromOptions(options: Options): this; setURL(url: string): this; setBaseURL(baseURL: string): this; setPath(path: string): this; setBodySchema(bodySchema: string): this; setAuth(auth: AuthInterface): this; setProxy(proxy: ProxyInterface): this; setMethod(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE'): this; setHeaders(headers: (HeadersInterface & Record<string, string>)): this; setBody(body: string): this; setQuery(query: string): this; setParams(params: string): this; setResponseEncoding(responseEncoding: ResponseEncoding): this; setResponseType(responseType: 'json' | 'text' | 'blob' | 'stream' | 'arrayBuffer' | 'document'): this; setMaxRedirects(maxRedirects: number): this; setRetryDelay(retryDelay: number): this; setTimeout(timeout: number): this; }