# Unable to read header value for a request that is sent in Pre-req

**URL:** <https://community.postman.com/t/unable-to-read-header-value-for-a-request-that-is-sent-in-pre-req/17250>\
**Category:** Help Hub\
**Tags:** tests, authentication\
**Created:** [October 29, 2020, 9:41pm UTC](https://community.postman.com/t/unable-to-read-header-value-for-a-request-that-is-sent-in-pre-req/17250 "2020-10-29T21:41:06Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 30, 2020, 11:33am UTC](https://community.postman.com/t/unable-to-read-header-value-for-a-request-that-is-sent-in-pre-req/17250/3 "2020-10-30T11:33:45Z")

</div>

Hey @baljindernohra, welcome!

This can certainly seem tricky since you’re using `pm.sendRequest` to send your request instead of as a “proper” postman request.

You are going to have to use the response variable from your callback instead of `pm.response` to get what you want. Take this example of calling the postman echo API:

```auto
pm.sendRequest({
    url: 'https://postman-echo.com/post',
    method: 'POST'
}, function(err, res){
    const location = res.headers.find(h => h.key == 'Location');
    pm.environment.set('location', location);
});

```

So you can see that `res` is my response variable in the callback. You can get to the headers from there.

---

_[View the full topic](https://community.postman.com/t/unable-to-read-header-value-for-a-request-that-is-sent-in-pre-req/17250)._
