Ver código fonte

fix(autn_http): log an error when `content_type` is unsupported

firest 1 ano atrás
pai
commit
d2a5b69db7

+ 1 - 1
apps/emqx_auth_http/src/emqx_auth_http.app.src

@@ -1,7 +1,7 @@
 %% -*- mode: erlang -*-
 {application, emqx_auth_http, [
     {description, "EMQX External HTTP API Authentication and Authorization"},
-    {vsn, "0.4.0"},
+    {vsn, "0.4.1"},
     {registered, []},
     {mod, {emqx_auth_http_app, []}},
     {applications, [

+ 2 - 2
apps/emqx_auth_http/src/emqx_authn_http.erl

@@ -306,8 +306,8 @@ parse_body(<<"application/json", _/binary>>, Body) ->
 parse_body(<<"application/x-www-form-urlencoded", _/binary>>, Body) ->
     NBody = maps:from_list(cow_qs:parse_qs(Body)),
     {ok, NBody};
-parse_body(ContentType, _) ->
-    {error, {unsupported_content_type, ContentType}}.
+parse_body(_ContentType, _) ->
+    erlang:throw(unsupported_content_type).
 
 request_for_log(Credential, #{url := Url, method := Method} = State) ->
     SafeCredential = emqx_authn_utils:without_password(Credential),