diff options
Diffstat (limited to 'src/plop_httputil.erl')
-rw-r--r-- | src/plop_httputil.erl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plop_httputil.erl b/src/plop_httputil.erl index 81a99b1..b6bbf8e 100644 --- a/src/plop_httputil.erl +++ b/src/plop_httputil.erl @@ -92,7 +92,7 @@ request(DebugTag, URL, Headers, RequestBody, Method) -> get -> "GET"; post -> "POST" end, - #hackney_url{path = Path, host = Host} = ParsedURL, + #hackney_url{path = Path, host = Host, qs = QueryString, raw_path = RawPath} = ParsedURL, lager:debug("~s: sending http request to ~p", [DebugTag, URL]), case hackney:connect(ParsedURL, @@ -105,11 +105,20 @@ request(DebugTag, URL, Headers, RequestBody, Method) -> lager:debug("~s: connected to ~p", [DebugTag, URL]), {ok, StatusCode, RespHeaders, ClientRef} = - hackney:send_request(ConnRef, - {Method, Path, - add_auth(MethodString, Path, Headers, - RequestBody), - {fun chunk_data/1, RequestBody}}), + case Method of + post -> + hackney:send_request(ConnRef, + {Method, Path, + add_auth(MethodString, Path, Headers, + RequestBody), + {fun chunk_data/1, RequestBody}}); + get -> + hackney:send_request(ConnRef, + {Method, RawPath, + add_auth(MethodString, Path, Headers, + QueryString), + <<>>}) + end, lager:debug("~s: received headers for ~p: ~p", [DebugTag, URL, RespHeaders]), {ok, Body} = hackney:body(ClientRef), |