Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I want to capture source request information (IP address/ hostname/ client details)[HTTP headers ] when I use tRestRequest.
Please help, how I can do it?
Hello,
You can access individual headers by adding parameters in a schema editor and adding a 'header' to the Comment field. tRESTRequest also sets the map of all the headers it receives as a context var which means All HTTP headers are available as a map on the request context.
Bestr regards
Sabrina
I added 'header' in a schema editor to the Comment field:
Hi,
In field column, you have to set the name of your header value.
Eric
Field column does not accept dash, for example: how I can get X-Forwarded-For?
Hi,
With this piece of code in a tJavaFlex, you can get your header value (In my example, header name is NAME-TEST):
java.util.Map<String, java.util.Map<String, List<String>>> restReq =
(java.util.Map<String, java.util.Map<String, List<String>>>)globalMap.get("restRequest");
java.util.Map<String, List<String>> headers = restReq.get("ALL_HEADER_PARAMS");
List<String> myheader = headers.get("NAME-TEST");
String headervalue = myheader.get(0);
System.out.println(headervalue);
Eric
Thx, I know this method, but I think it is not true way. It is stop gap solutions)