cancel
Showing results for 
Search instead for 
Did you mean: 

Request

Highlighted
Occasional Contributor

Request

Hi

I am trying to save the request and response in a folder along with time stamp. I am able to save the response with timestamp. But request is saving with empty file. please find the below code :

 

import groovy.json.JsonOutput;

testCase.testStepList.each{
type = it.config.type
name = it.name
response = it.getPropertyValue("Response")
request = it.getPropertyValue("Request")

if(type == "restrequest"){

def pretty = JsonOutput.prettyPrint(response);
def req = JsonOutput.prettyPrint(request);
date = new Date()
dateFormat = new java.text.SimpleDateFormat('yyyyMMdd-HHmmss')
shortDate = dateFormat.format(date)
def responseFile= "C://Users//SS//Desktop//proj//"+name.toString()+shortDate+"_response.doc";
def requestFile= "C://Users//SS//Desktop//proj//"+name.toString()+shortDate+"_request.doc";
def rsfile = new File(responseFile);
def reqfile = new File(requestFile);
rsfile.write(pretty, "UTF-8");
reqfile.write(req,"UTF-8");
}
}

Request file has the user name and password in encrypted form with multiple columns.

 

Thanks.

4 REPLIES 4
Highlighted
Community Manager

Re: Request

@HimanshuTayal , @nmrao @msiadak  @Redde 

Any ideas on what might be the cause? Thank you!

 


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Leader

Re: Request

@Sirisha2020 : What is the type of request(GET/PUT/POST/Other).. it will be helpful if you could provide any screenshot of request.


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Occasional Contributor

Re: Request

Hi,

 

We are using GET request to get the details. 

Highlighted
Occasional Contributor

Re: Request

please find the raw request 

GET https://XXXehwmanor001:9508/wma-rest/contracts/5EK6iiqaQRmE0GxUWeCDmQ%3D%3D HTTP/1.1
Accept-Encoding: gzip,deflate
X-XXX-Authn-Token: AQIC5wM2LY4Sfczk1CLpfbXvO7xPre1AxqUnfQuHHCfWXKs.*AAJTSQACMDEAAlNLABQtNDU5NTQ4NzkxNzU4NzEyMDA4NwACUzEAAA..*
Host: xxxehwmanor001:9508
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/12.0.1)

New Here?
Join us and watch the welcome video:
Announcements