How to get auto-generated headers with pm.request.headers?

I have a pre-request script which uses pm.sendRequest to call an endpoint that uses the same auth as the current request. I tried to use pm.request.headers in the script to get the Authorization header so I could add the same header in the pm.sendRequest call, but it doesn’t return the auto-generated headers, only the headers I’ve set manually. Is there any way to access to auto-generated headers in a pre-request script?

I tried

header: {
    "Authorization": pm.request.headers.get("Authorization"),
    "Content-Type": "application/json"
},
1 Like

Any solution for this? the same pm.request.headers[“authorization”] working in Test but not in pre-request