-module(typed_headers). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([to_string/1]). -export_type([header/0]). -type header() :: {content_type_header, content_type:content_type()} | {custom_header, binary(), binary()} | {custom_raw_header, binary()}. -spec h(binary(), binary()) -> binary(). h(Name, Value) -> <<<>/binary, Value/binary>>. -spec to_string(header()) -> binary(). to_string(Header) -> case Header of {content_type_header, C} -> h(<<"Content-Type"/utf8>>, content_type:to_string(C)); {custom_header, Name, Value} -> h(Name, Value); {custom_raw_header, S} -> S end.