Forum Discussion

kathir_43's avatar
kathir_43
Contributor
7 days ago

POST method with x-www-form-urlencoded body request using testcomplete

we are trying to send http request using GET method and has body parameters in x-www-form-urlencoded as content type . i ended up 400-Bad request always. 

Following is the sample method which i have created:

function test(){

var request,postdata,response;

request= aqHttp.CreateGetRequest("https://login.microsoftonline.com/XXXXXXXX/oauth2/V2.0/token");

request.SetHeader("Content-Type","application/x-www-form-urlencoded")

postdata="client_id=xxxxx;client_secret=*******"

response= request.Send(postdata);

Log.message(response.statuscode)

Any sample method for this scenario would be helpful. Thanks!

 

 

 

 

3 Replies