Forum Discussion
https://youtu.be/L2SMZ9bbDvE
Hi, nmrao. I watched the video, and he is injecting properties into the response in a similar way that we're doing it. I believe his code has a similar vulnerability that we have - it's possible for two clients to get the same value in a response from his virtual service, but his intention was for each response to be random.
- nmrao3 years agoChampion Level 3Would you clarify what exactly you need and what you tried and what is not not working? That will help to find the solution.
- swalchemist3 years agoOccasional Contributor
This is not working when I use this as a response:
mode="${=def clientId = mockRequest.getRequestHeaders().get("myClientId").get(0); context.expand("#MockService#" + clientId + "-mode")}'"
The problem is that "mockRequest" is not made available to code that is injected in a response like this (only in code in the script pane). Is there any way to read the request headers from code in the response?
We have some code in another response that modifies dates - this is working fine.
Other ideas on how to maintain state for multiple users of the virtual service is welcome. That state will affect the content of the responses.
- nmrao3 years agoChampion Level 3Not sure I understand.
Is it that a value from request needs to be into the response?
Are you working with SOAP or REST?