Is there any way to check if different formats of the same header is supported in postman tests?

I have requests that require a token. Its passed in the header for the request as a key value pair with the key being access_token and the value being its value. Now different formats of the access token needs to be supported. eg: AccessToken,Access-Token,Access_Token. Is there any way I can verify it?

You can easily replace the header KEY with a Postman variable and build a small workflow with postman.setNextRequest or use a CSV or JSON data file for iterations.

I’m already using variables for setting the value of the token. I’m not sure how to set a list of values for the header KEYs and iterate through them.

As shown in the attachment, I need to write a test case to check whether all these different variations are supported one by one.

You need to send one header at a time, not all at once.

Set the KEY to {{AccessTokenHeaderName}} and the value to {{AccessToken}}

Use a CSV file or a JSON file to run the same request multiple times with a different data-set. Here is a similar example:

Yes. I will do that. Great video too. Thank you. So I’m guessing I just have to assert if status code is 200 right?

Yes, testing that the status code is 200 would be a good approach in your case.

1 Like