Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Extract response header value in postman?

Tags:

postman

How can I fetch the value of a response header in postman and save it in a variable so that I can use it in the next request?

Example:

HeaderName: HeaderValue
AESKey: ndowijdw92n9992n

I need to fetch ndowijdw92n9992n and send it to the next request.

like image 370
Bhavya Dutta Avatar asked Sep 03 '25 07:09

Bhavya Dutta


1 Answers

There is more direct way to access AESKey header:

const responseHeaderAESKey = pm.response.headers.get("AESKey");
pm.environment.set("AESKey", responseHeaderAESKey );

Now the environment variable set contains the AESKey and you can access it in any part of Postman request with {{AESKey}}. So use it in the next request.

like image 117
Srđan Popić Avatar answered Sep 04 '25 23:09

Srđan Popić