Forum Discussion

CamillaR's avatar
CamillaR
Occasional Contributor
4 years ago

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 si...
  • CamillaR's avatar
    CamillaR
    4 years ago

    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