Capture header value from POST to transfer to subsequent GET's header?
I recently posted a query (see link) about scraping the header attributes in a POST's response to transfer onto a subsequent GET request and the query was successfully answered....so thankyou!
HOWEVER - what I didn't appreciate was that the subsequent GET request's filter isn't via a query string or template on the URI I'm calling - I actually need to pass the value to the GET request's header.
My current test hierarchy is as follows:
POST (response header includes a unique donorID header and value) Groovyscript (to extract the donorID header value and pass it to a Properties step) Properties (holds the donorID value from the groovystep) GET (request header includes a donorID header - I need to extract the value from the Properties step)
If I just had to pick up the property value to pass into the GET's query parameter or as a template parameter on the URI - this wouldn't be a problem - HOWEVER - the api that's been developed to enable me to test is filtering the GET request via the donorID header value.
Does anyone know how to do this? There doesn't appear to be any embedded functionality to enable me to do this property transfer to a request's header....the only thing I can think of doing is hard coding the donorID value for the GET request - but this is a rubbish solution!
Thanks to all for any help/guidance/advice anyone can provide
I'm an idiot.
To reiterate - in my test case I have a POST which generates a response header value that I needed to pass onto a subsequent GETs request header
I didn't know about the header parameter you can specify when you create the service/resource/method/request. I knew you could add query, matrix, and template parms - but not header parms - this is exactly what I needed.
All I needed to do was re-create the subsequent GET request ensuring to specify it uses a header parameter.
The groovyscript extracts the header value from the previous requests response and populates the properties file. The Property Transfer handles the transfer. Then via the subsequent request in the test that needs the header value - just click on the ellipsis button on the value field to 'GetData' from the Properties file!