How do we set x-www-form-urlencoded type body in jenkins pipeline/groovy post request?

Viewed 35

def body ='{"1":"ab","2":"cd"}'

def response = httpRequest(httpMode: 'POST', url: "https://***/xyz", customHeaders:[[name:"Content-type",value:"application/x-wwww-form-urlencoded"]], body =body)

Expected response is json values.Here always received Html page.

IN Postman, when we choose body type is x-wwww-form-urlencoded , we are getting correct json format response. IN Postman, when we choose any other body type/no body , we are getting html formatted output.

      How do we achieve similar json output via jenkins/groovy script?

genkins website content ::: requestBody : String (optional) The raw body of the request.

   How do we set x-wwww-form-urlencoded type body in jenkins post request?
0 Answers
Related