question

ozn avatar image
ozn asked ovidiu_constantin answered

REST Token or header in inheritable

When we commonly use REST API to wherever, we need to include some token or cokie in each the REST query. After we create a session profile, we pass the handle in different procedure/quick calls. When we do that in the the REST query step does not inherit the token or header. We are using global variable/parameters to get the values. Is there a better way you guys suggest?

In python, once we modify the rest session object in one place, we don't have to worry about it in each query. This seems to be an issue in itest, at least not very straight forward.

restrest session profile
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ovidiu_constantin avatar image
ovidiu_constantin answered

Hello @ozn

I'm Ovidiu from Spirent support.

The current implementation of the rest session is set to be inline with the whole iTest functionality.

I'm presuming you're setting the token as a variable in a HTTP header on the open step.

As it is expected, if the variable is local it will not be seen by a subsequent procedure/quickCall.

As you stated, the solution is either to set the token variable as global or set it in a parameter.

The modification to the rest session needs to be done only in one place (at the open step ) and the rest of the steps related to that session will inherit the changes.

Please let me know if this is the behavior you are seeing.

Thank you.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.