An object that represents a header to add to an HTTP request.

Implements

Constructors

  • Constructs a new Header.

    Parameters

    • Optional properties: IHeader

      Properties to set

    Returns Header

Properties

key: string

A header key such as Authorization or Content-Type

value: string

A value for the given header key like Basic MYAUTHKEY or application/json

Methods

  • Converts this Header to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new Header instance using the specified properties.

    Parameters

    • Optional properties: IHeader

      Properties to set

    Returns Header

    Header instance

  • Decodes a Header message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns Header

    Header

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a Header message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns Header

    Header

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified Header message. Does not implicitly verify messages.

    Parameters

    • message: IHeader

      Header message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified Header message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: IHeader

      Header message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a Header message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns Header

    Header

  • Gets the default type url for Header

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a Header message. Also converts values to other types if specified.

    Parameters

    • message: Header

      Header

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a Header message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not