then-request

  • Version 6.0.2
  • Published
  • 29.7 kB
  • 11 dependencies
  • MIT license

Install

npm i then-request
yarn add then-request
pnpm add then-request

Overview

A request library that returns promises, inspired by request

Index

Variables

variable _default

const _default: RequestFn;

    Classes

    class ResponsePromise

    class ResponsePromise extends Promise<Response<Buffer | string>> {}

      method getBody

      getBody: { (encoding: string): Promise<string>; (): Promise<any> };

        Interfaces

        interface Options

        interface Options {}

          property agent

          agent?: boolean | Agent;

            property allowRedirectHeaders

            allowRedirectHeaders?: string[];

              property body

              body?: string | Buffer | NodeJS.ReadableStream;

                property cache

                cache?: 'file' | 'memory' | ICache;

                  property canCache

                  canCache?: (
                  res: Response<NodeJS.ReadableStream>,
                  defaultValue: boolean
                  ) => boolean;

                    property followRedirects

                    followRedirects?: boolean;

                      property form

                      form?: FormData;

                        property gzip

                        gzip?: boolean;

                          property headers

                          headers?: IncomingHttpHeaders;

                            property isExpired

                            isExpired?: (cachedResponse: CachedResponse, defaultValue: boolean) => boolean;

                              property isMatch

                              isMatch?: (
                              requestHeaders: IncomingHttpHeaders,
                              cachedResponse: CachedResponse,
                              defaultValue: boolean
                              ) => boolean;

                                property json

                                json?: any;

                                  property maxRedirects

                                  maxRedirects?: number;

                                    property maxRetries

                                    maxRetries?: number;

                                      property qs

                                      qs?: {
                                      [key: string]: any;
                                      };

                                        property retry

                                        retry?:
                                        | boolean
                                        | ((
                                        err: NodeJS.ErrnoException | null,
                                        res: Response<NodeJS.ReadableStream | Buffer | string> | void,
                                        attemptNumber: number
                                        ) => boolean);

                                          property retryDelay

                                          retryDelay?:
                                          | number
                                          | ((
                                          err: NodeJS.ErrnoException | null,
                                          res: Response<NodeJS.ReadableStream | Buffer | string> | void,
                                          attemptNumber: number
                                          ) => number);

                                            property socketTimeout

                                            socketTimeout?: number;

                                              property timeout

                                              timeout?: number;

                                                Type Aliases

                                                type Response

                                                type Response = GenericResponse<Buffer | string>;

                                                  Package Files (3)

                                                  Dependencies (11)

                                                  Dev Dependencies (12)

                                                  Peer Dependencies (0)

                                                  No peer dependencies.

                                                  Badge

                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/then-request.

                                                  • Markdown
                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/then-request)
                                                  • HTML
                                                    <a href="https://www.jsdocs.io/package/then-request"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>