fix(stomp): pass the Content-Type from the MQTT message
This commit is contained in:
parent
2a2fadfbff
commit
95f3e49edb
|
@ -1,7 +1,7 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{application, emqx_gateway_stomp, [
|
||||
{description, "Stomp Gateway"},
|
||||
{vsn, "0.1.5"},
|
||||
{vsn, "0.1.6"},
|
||||
{registered, []},
|
||||
{applications, [kernel, stdlib, emqx, emqx_gateway]},
|
||||
{env, []},
|
||||
|
|
|
@ -1039,7 +1039,7 @@ handle_deliver(
|
|||
{<<"subscription">>, Id},
|
||||
{<<"message-id">>, next_msgid()},
|
||||
{<<"destination">>, emqx_message:topic(NMessage)},
|
||||
{<<"content-type">>, <<"text/plain">>}
|
||||
{<<"content-type">>, content_type_from_mqtt_message(NMessage)}
|
||||
],
|
||||
Headers1 =
|
||||
case Ack of
|
||||
|
@ -1080,6 +1080,13 @@ handle_deliver(
|
|||
),
|
||||
{ok, [{outgoing, lists:reverse(Frames0)}], Channel}.
|
||||
|
||||
content_type_from_mqtt_message(Message) ->
|
||||
Properties = emqx_message:get_header(properties, Message, #{}),
|
||||
case maps:get('Content-Type', Properties, undefined) of
|
||||
undefined -> <<"text/plain">>;
|
||||
ContentType -> ContentType
|
||||
end.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Handle timeout
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue