View Source HTTPSpec.Response (http_spec v3.0.0)
A struct for describing HTTP responses.
Summary
Types
@type body() :: iodata() | nil
@type status() :: non_neg_integer()
@type t() :: %HTTPSpec.Response{ body: body(), headers: HTTPSpec.Header.headers(), status: status(), trailers: HTTPSpec.Trailer.trailers() }
Functions
@spec new(keyword() | map()) :: {:ok, t()} | {:error, HTTPSpec.ArgumentError.t()}
Creates a response from given options.
The options can be provided as a keyword list or a map.
Examples
HTTPSpec.Response.new(%{
status: 200,
headers: [
{"content-type", "text/html"}
],
body: "<html>...</html>"
})
Bang version of new/1
.