I am getting following header in response : HTTP/1.1 200 OK Date: Mon, 11 Apr 2016 10:36:10 GMT content-disposition: attachment; filename=result.xml; x-xss-protection: 1; mode=access Keep-Alive: timeout=5, max=100 I want to read filename from header, how can I use regular expression to capture this value ?
11
votes
2 Answers
22
votes
- Add Regular Expression Extractor as a child of the HTTP Request which returns above headers
Configure it as follows:
Refer extracted value as
${filename}
where required
0
votes
Use a PostProcessor element and refer required element with ctx.getPreviousResult().XXX, for example:
ctx.getPreviousReult().getResponseCode();
ctx.getPreviousResult().getResponseHeaders();
Here the output goes to file:
log.info(ctx.getPreviousResult().getResponseDataAsString());
log.info(ctx.getPreviousResult().getContentType());
log.info(ctx.getPreviousResult().getUrlAsString());