Reputation: 934
Im trying to set request header using property transfer step, but could not get anyway to access headers using JsonPath
.
What to write in highlighted section to access request headers using jsonPath
Please help...
Response structure in Source:
{
"payload": {
"content": {
"reason": "token successfully created",
"success": "true",
"authDetails": {
"accessToken": "MyaccesToken",
"expiresIn": "My ExpiryTime",
"refreshToken": "MyRefreshToken"
}
}
}
}
Request structure in Target field
GET https://Myendpoint/myresouce/etc HTTP/1.1
Header1: myHeader1Value
Header2: **<Im trying to assign "MyaccessToken" in above step to this header>**
Upvotes: 0
Views: 4986
Reputation: 972
I know I'm a bit late to the party but anyone who stumbles on this question now might still find this useful. You don't have to use the project's custom properties but you can define a property in the test case as well.
First append a Properties step to your test case:
In that properties test step define a property called token (or any other name of your chosing).
Now add a Property Transfer step and choose Target: Properties (the step you just created) and Property: token (the property you just defined).
Now you can access the contents of that property in all the test steps after that one by simply putting ${token}
.
So probably you'll want to do something like in the headers section put
Authorization: Bearer ${token}
Upvotes: 0
Reputation: 21389
Here how you could achieve this:
TOKEN
at project level.Project name
, and select TOKEN
for Property.${#Project#TOKEN}
Upvotes: 5