Skip to content

Commit

Permalink
fix(http header): fix bad path and header
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouzb committed Dec 25, 2020
1 parent dd707c3 commit a94a9e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/emqx_auth_http_cli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
%%--------------------------------------------------------------------

request(PoolName, get, Path, Headers, Params, Timeout) ->
NewPath = Path ++ "?" ++ cow_qs:qs(bin_kw(Params)),
NewPath = Path ++ "?" ++ binary_to_list(cow_qs:qs(bin_kw(Params))),
reply(emqx_http_client:request(get, PoolName, {NewPath, Headers}, Timeout));

request(PoolName, post, Path, Headers, Params, Timeout) ->
Body = case proplists:get_value(<<"content_type">>, Headers) of
Body = case proplists:get_value(<<"content-type">>, Headers) of
<<"application/x-www-form-urlencoded">> ->
cow_qs:qs(bin_kw(Params));
<<"application/json">> ->
Expand Down
6 changes: 3 additions & 3 deletions test/emqx_auth_http_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ set_special_configs(emqx, _Schmea, _Inet) ->
set_special_configs(emqx_auth_http, Schema, Inet) ->
ServerAddr = http_server(Schema, Inet),

AuthReq = #{method => get,
AuthReq = #{method => post,
url => ServerAddr ++ "/mqtt/auth",
content_type => <<"application/x-www-form-urlencoded">>,
content_type => <<"application/json">>,
params => [{"clientid", "%c"}, {"username", "%u"}, {"password", "%P"}]},
SuperReq = #{method => post,
url => ServerAddr ++ "/mqtt/superuser",
content_type => <<"application/x-www-form-urlencoded">>,
content_type => <<"application/json">>,
params => [{"clientid", "%c"}, {"username", "%u"}]},
AclReq = #{method => post,
url => ServerAddr ++ "/mqtt/acl",
Expand Down

0 comments on commit a94a9e0

Please sign in to comment.