Postman - Override User-Agent for each request

Viewed 3293

I have a website which is only accessible after a basic auth login.

You can bypass that with a certain User-Agent.

Is there a way to always set the user agent to a certain value for new requests?

Currently it is hardcoded to PostmanRuntime/7.29.0

enter image description here

At the moment I always set it manually for each request, but this is slowing down the workflow.

1 Answers

You can set that on collection level, then each request in given collection will inherit it.

enter image description here

pm.request.headers.add({key: 'User-Agent', value: 'FooBar'});

Now... you won't see this applied on request level! You must make a request in order for script to run, and override one set on request level!

Use console to check actual header value.

Console preview

Related