Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BodyCodec<T>

A codec for encoding and decoding HTTP bodies.

Type parameters

  • T

Hierarchy

  • BodyCodec

Index

Methods

Static buffer

  • Returns BodyCodec<Buffer>

Static create

  • create<T>(decode: (arg: Buffer) => T): BodyCodec<T>
  • Create a codec that buffers the entire body and then apply the decode function and returns the result.

    Type parameters

    • T

    Parameters

    • decode: (arg: Buffer) => T
        • (arg: Buffer): T
        • Parameters

          • arg: Buffer

          Returns T

    Returns BodyCodec<T>

Static json

  • Create and return a codec for Java objects encoded using Jackson mapper.

    Type parameters

    • U

    Parameters

    • type: any

    Returns BodyCodec<U>

Static jsonArray

  • Returns BodyCodec<any[]>

Static jsonObject

  • Returns BodyCodec<{}>

Static jsonStream

  • jsonStream(parser: JsonParser): BodyCodec<void>
  • A body codec that parse the response as a JSON stream.

    Parameters

    • parser: JsonParser

    Returns BodyCodec<void>

Static none

  • Returns BodyCodec<void>

Static pipe

  • pipe(stream: WriteStream<Buffer>): BodyCodec<void>
  • pipe(stream: WriteStream<Buffer>, close: boolean): BodyCodec<void>
  • A body codec that pipes the body to a write stream.

    Same as pipe(stream, true).

    Parameters

    • stream: WriteStream<Buffer>

    Returns BodyCodec<void>

  • A body codec that pipes the body to a write stream.

    Parameters

    • stream: WriteStream<Buffer>
    • close: boolean

    Returns BodyCodec<void>

Static string

  • Returns BodyCodec<string>

  • A codec for strings using a specific encoding.

    Parameters

    • encoding: string

    Returns BodyCodec<string>

Generated using TypeDoc