Instream v1.0.0 Instream.Response View Source

Response parser.

Link to this section Summary

Functions

Maybe parses a response based on the requested result type.

Parses the response of a ping query.

Parses the response of a status query.

Parses the response of a version query.

Link to this section Types

Specs

t() ::
  {:error, term()}
  | {status :: pos_integer(), headers :: list(), body :: String.t()}

Link to this section Functions

Link to this function

maybe_parse(error, opts)

View Source

Specs

maybe_parse(t(), Keyword.t()) :: any()

Maybe parses a response based on the requested result type.

Specs

parse_ping(any()) :: :pong | :error

Parses the response of a ping query.

Specs

parse_status(any()) :: :ok | :error

Parses the response of a status query.

Specs

parse_version(any()) :: String.t() | :error

Parses the response of a version query.

Returns "unknown" if the response did not contain a parseable header.