diff options
Diffstat (limited to 'src/rabbit_basic.erl')
-rw-r--r-- | src/rabbit_basic.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index cc876cb4..8ad59016 100644 --- a/src/rabbit_basic.erl +++ b/src/rabbit_basic.erl @@ -20,7 +20,7 @@ -export([publish/4, publish/6, publish/1, message/3, message/4, properties/1, append_table_header/3, - map_headers/2, delivery/4, header_routes/1]). + extract_headers/1, map_headers/2, delivery/4, header_routes/1]). -export([build_content/2, from_content/1]). %%---------------------------------------------------------------------------- @@ -61,6 +61,8 @@ -spec(append_table_header/3 :: (binary(), rabbit_framing:amqp_table(), headers()) -> headers()). +-spec(extract_headers/1 :: (rabbit_types:content()) -> headers()). + -spec(map_headers/2 :: (rabbit_types:content(), fun((headers()) -> headers())) -> rabbit_types:content()). @@ -186,6 +188,11 @@ append_table_header(Name, Info, Headers) -> end, rabbit_misc:set_table_value(Headers, Name, array, [{table, Info} | Prior]). +extract_headers(Content) -> + #content{properties = #'P_basic'{headers = Headers}} = + rabbit_binary_parser:ensure_content_decoded(Content), + Headers. + map_headers(F, Content) -> Content1 = rabbit_binary_parser:ensure_content_decoded(Content), #content{properties = #'P_basic'{headers = Headers} = Props} = Content1, |