How can I use a property in the header for a request in ReadyAPI
Hi,
I have a SoapUI project where I use a project property "token" that is used in the header of the requests, I reference it as ${#Project#token},
see attachment for more details. I do this since I have many requests and the token needs to be renewed every hour. I load the token value into the property using a groovy script test step. This works fine when I run my requests using SoapUI 5.6.0.
Now I have installed ReadyAPI 3.1.0 and imported my SoapUI project. When I run my requests in ReadyAPI I get error 503 Service Unavailable. It works OK if I use the real value in the header, e.g "Bearer eyJ0eXAiOiJKV...." but not when I use ${#Project#token} in the header.
Why does it work in SoapUI but not in ReadyAPI?
And how can I use the project property in the header?
Kind Regards,
Camilla
Hi nmrao,
You were on to something here. The problem was in my token.
1. I run a curl command in bash to generate the token and save the result to a textfile. This is done by adding " > c:/mytokenfile.txt" after the curl command
2. In SoapUI/ReadyAPI, my groovy script reads the textfile and stores the contents in the project property.
The problem was this: When storing the token value into a textfile cr+lf is added at the end. And this was also read into the property.
When viewing property value the cr+lf looks like a blank space in the end (in the property window).
I have now fixed my groovyscript so it does not store the cr+lf in the property.
Thanks for the help,
/Camilla