diff --git a/internal/modules/httpclient/http_client.go b/internal/modules/httpclient/http_client.go index afd9c2078..ade7b91ae 100644 --- a/internal/modules/httpclient/http_client.go +++ b/internal/modules/httpclient/http_client.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "strings" "time" ) @@ -31,7 +32,13 @@ func PostParams(url string, params string, timeout int) ResponseWrapper { if err != nil { return createRequestError(err) } - req.Header.Set("Content-type", "application/x-www-form-urlencoded") + if strings.Contains(params, "=") { + req.Header.Set("Content-type", "application/x-www-form-urlencoded") + } else if strings.Contains(params, "{") && strings.Contains(params, "}") { + req.Header.Set("Content-type", "application/json") + } else { + req.Header.Set("Content-type", "text/plain") + } return request(req, timeout) }