whitecap_protocol (whitecap v0.1.0)

View Source

Summary

Types

bin_patterns/0

-type bin_patterns() :: #bin_patterns{rn :: binary:cp(), rnrn :: binary:cp()}.

error/0

-type error() :: {error, reason()}.

reason/0

-type reason() :: bad_request | not_enough_data | unsupported_feature.

verb/0

-type verb() :: get | head | post | put.

whitecap_req/0

-type whitecap_req() ::
          #whitecap_req{state :: body | done,
                        verb :: verb(),
                        path :: binary(),
                        headers :: [binary()],
                        content_length :: undefined | non_neg_integer(),
                        body :: undefined | binary()}.

Functions

bin_patterns()

-spec bin_patterns() -> bin_patterns().

headers(Headers)

-spec headers([binary()]) -> {ok, [{binary(), undefined | binary()}]} | {error, invalid_headers}.

request(Data)

-spec request(binary()) -> {ok, whitecap_req(), binary()} | error().

request(Data, BinPatterns)

-spec request(binary(), bin_patterns()) -> {ok, whitecap_req(), binary()} | error().

request(Data, Whitecap_req, BinPatterns)

-spec request(binary(), undefined | whitecap_req(), bin_patterns()) ->
                 {ok, whitecap_req(), binary()} | error().