fix(bridge): HTTP reqeust crash if using GET an DELETE method
This commit is contained in:
parent
9d733c2ec5
commit
e2d899ad6e
|
@ -201,7 +201,7 @@ on_query(InstId, {KeyOrNum, Method, Request, Timeout}, AfterQuery,
|
||||||
#{pool_name := PoolName, base_path := BasePath} = State) ->
|
#{pool_name := PoolName, base_path := BasePath} = State) ->
|
||||||
?TRACE("QUERY", "http_connector_received",
|
?TRACE("QUERY", "http_connector_received",
|
||||||
#{request => Request, connector => InstId, state => State}),
|
#{request => Request, connector => InstId, state => State}),
|
||||||
NRequest = update_path(BasePath, Request),
|
NRequest = formalize_request(Method, BasePath, Request),
|
||||||
case Result = ehttpc:request(case KeyOrNum of
|
case Result = ehttpc:request(case KeyOrNum of
|
||||||
undefined -> PoolName;
|
undefined -> PoolName;
|
||||||
_ -> {PoolName, KeyOrNum}
|
_ -> {PoolName, KeyOrNum}
|
||||||
|
@ -310,10 +310,14 @@ check_ssl_opts(URLFrom, Conf) ->
|
||||||
{_, _} -> false
|
{_, _} -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
update_path(BasePath, {Path, Headers}) ->
|
formalize_request(Method, BasePath, {Path, Headers, _Body})
|
||||||
{filename:join(BasePath, Path), Headers};
|
when Method =:= get; Method =:= delete ->
|
||||||
update_path(BasePath, {Path, Headers, Body}) ->
|
formalize_request(Method, BasePath, {Path, Headers});
|
||||||
{filename:join(BasePath, Path), Headers, Body}.
|
formalize_request(_Method, BasePath, {Path, Headers, Body}) ->
|
||||||
|
{filename:join(BasePath, Path), Headers, Body};
|
||||||
|
|
||||||
|
formalize_request(_Method, BasePath, {Path, Headers}) ->
|
||||||
|
{filename:join(BasePath, Path), Headers}.
|
||||||
|
|
||||||
bin(Bin) when is_binary(Bin) ->
|
bin(Bin) when is_binary(Bin) ->
|
||||||
Bin;
|
Bin;
|
||||||
|
|
Loading…
Reference in New Issue