mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00
NOISSUE - Fix hackney HTTP request (#833)
* Add socket pool and fix pattern matching Signed-off-by: drasko <drasko.draskovic@gmail.com> * Fix hackney req Signed-off-by: drasko <drasko.draskovic@gmail.com>
This commit is contained in:
parent
a8836d67e0
commit
9ccc37c4b1
@ -39,10 +39,9 @@ identify(Password) ->
|
||||
URL = [list_to_binary(AuthUrl), <<"/identify">>],
|
||||
ReqBody = jsone:encode(#{<<"token">> => Password}),
|
||||
ReqHeaders = [{<<"Content-Type">>, <<"application/json">>}],
|
||||
Payload = <<>>,
|
||||
Options = [{pool, default}],
|
||||
error_logger:info_msg("identify: ~p", [URL]),
|
||||
case hackney:request(post, URL, ReqHeaders, ReqBody, Payload, Options) of
|
||||
case hackney:request(post, URL, ReqHeaders, ReqBody, Options) of
|
||||
{ok, Status, _, Ref} ->
|
||||
case Status of
|
||||
200 ->
|
||||
@ -71,9 +70,8 @@ access(UserName, ChannelId) ->
|
||||
error_logger:info_msg("URL: ~p", [URL]),
|
||||
ReqBody = jsone:encode(#{<<"thing_id">> => UserName}),
|
||||
ReqHeaders = [{<<"Content-Type">>, <<"application/json">>}],
|
||||
Payload = <<>>,
|
||||
Options = [{pool, default}],
|
||||
case hackney:request(post, URL, ReqHeaders, ReqBody, Payload, Options) of
|
||||
case hackney:request(post, URL, ReqHeaders, ReqBody, Options) of
|
||||
{ok, Status, _RespHeaders, _ClientRef} ->
|
||||
case Status of
|
||||
200 ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user