From b07766ab936f74e1c46b23a8d48a266a89594ac0 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 7 May 2019 20:11:10 +0200 Subject: [PATCH] Include Content-Type header in POST requests (#273) --- ejabberd_auth_http/src/ejabberd_auth_http.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ejabberd_auth_http/src/ejabberd_auth_http.erl b/ejabberd_auth_http/src/ejabberd_auth_http.erl index 2e657d8..a665f9e 100644 --- a/ejabberd_auth_http/src/ejabberd_auth_http.erl +++ b/ejabberd_auth_http/src/ejabberd_auth_http.erl @@ -219,6 +219,7 @@ make_req(Method, Path, LUser, LServer, Password) -> PasswordE = list_to_binary(http_uri:encode(binary_to_list(Password))), Query = <<"user=", LUserE/binary, "&server=", LServerE/binary, "&pass=", PasswordE/binary>>, Header = [{<<"Authorization">>, <<"Basic ", BasicAuth64/binary>>}], + ContentType = {<<"Content-Type">>, <<"application/x-www-form-urlencoded">>}, Connection = cuesport:get_worker(existing_pool_name(LServer)), ?DEBUG("Making request '~s' for user ~s@~s...", [Path, LUser, LServer]), @@ -226,7 +227,7 @@ make_req(Method, Path, LUser, LServer, Password) -> get -> fusco:request(Connection, <>, "GET", Header, "", 2, 5000); post -> fusco:request(Connection, <>, - "POST", Header, Query, 2, 5000) + "POST", [ContentType|Header], Query, 2, 5000) end, ?DEBUG("Request result: ~s: ~p", [Code, RespBody]),