@types/shot

  • Version 4.0.0
  • Published
  • 7.28 kB
  • 1 dependency
  • MIT license

Install

npm i @types/shot
yarn add @types/shot
pnpm add @types/shot

Overview

TypeScript definitions for shot

Index

Functions

function inject

inject: (
dispatchFunc: Listener,
options: RequestOptions
) => Promise<ResponseObject>;

function isInjection

isInjection: (obj: any) => boolean;

Interfaces

interface Headers

interface Headers {}

    index signature

    [header: string]: string | string[];

      interface RequestOptions

      interface RequestOptions {}

      property authority

      authority?: string;
      • a string specifying the HTTP HOST header value to be used if no header is provided, and the url does not include an authority component. Defaults to 'localhost'.

      property headers

      headers?: Headers;
      • an optional object containing request headers.

      property method

      method?: string;
      • a string specifying the HTTP request method, defaulting to 'GET'.

      property payload

      payload?: string | Buffer | Stream | object;
      • an optional request payload. Can be a string, Buffer, Stream or object.

      property remoteAddress

      remoteAddress?: string;
      • an optional string specifying the client remote address. Defaults to '127.0.0.1'.

      property simulate

      simulate?: {
      /** indicates whether the request will fire an end event. Defaults to undefined, meaning an end event will fire. */
      end?: boolean;
      /** indicates whether the request payload will be split into chunks. Defaults to `undefined`, meaning payload will not be chunked. */
      split?: boolean;
      /** whether the request will emit an error event. Defaults to undefined, meaning no error event will be emitted. If set to true, the emitted error will have a message of 'Simulated'. */
      error?: boolean;
      /** whether the request will emit a close event. Defaults to undefined, meaning no close event will be emitted. */
      close?: boolean;
      };
      • an object containing flags to simulate various conditions:

      property url

      url: string;
      • a string specifying the request URL.

      property validate

      validate?: boolean;
      • Optional flag to validate this options object. Defaults to true.

      interface ResponseObject

      interface ResponseObject {}

      property headers

      headers: Headers;
      • an object containing the response headers.

      property payload

      payload: string;
      • the payload as a UTF-8 encoded string.

      property raw

      raw: {
      /** the simulated request object. */
      req: SimulatedRequestObject;
      /** the simulated response object. */
      res: SimulatedResponseObject;
      };
      • an object containing the raw request and response objects where:

      property rawPayload

      rawPayload: Buffer;
      • the raw payload as a Buffer.

      property statusCode

      statusCode: number;
      • the HTTP status code.

      property statusMessage

      statusMessage: string;
      • the HTTP status message.

      property trailers

      trailers: { [index: string]: any };
      • an object containing the response trailers.

      interface SimulatedRequestObject

      interface SimulatedRequestObject extends Readable {}

      interface SimulatedResponseObject

      interface SimulatedResponseObject extends ServerResponse {}

      Type Aliases

      type Listener

      type Listener = (req: SimulatedRequestObject, res: SimulatedResponseObject) => void;

      Package Files (1)

      Dependencies (1)

      Dev Dependencies (0)

      No dev dependencies.

      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/@types/shot.

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