Reputation: 609
globals.get
, variables.get
, etc)?I'm writing a Go/Gin based API that serves HTTPS requests but uses a self-signed cert locally. I'd like to be able to run tests with Postman locally without having to disable SSL cert verification for each individual request or globally, and then re-enable SSL cert verification after the response is received (considering the security implications of forgetting this step).
The ideal case would be using a (Postman) environment variable to trigger collection pre-request script logic to temporarily disable SSL verification, but I haven't found anything in the documentation that clearly points to a way to do this. I tried console.log
ging out the different variable scopes with toObject()
, but nothing really sticks out to me.
Since there is a per-request setting to disable SSL cert verification, as well as a global setting, it stands to reason that this should be able to be made available at the global and request script variable levels, but I can't say for sure if this is exposed to the scripting sandbox or not.
Upvotes: 0
Views: 3011
Reputation: 19979
http://www.postmanlabs.com/postman-collection/
Try using postman collection sdk
var Certificate = require('postman-collection').Certificate,
certificate = new Certificate({
name: 'Certificate for example.com',
matches: ['example.com'],
key: { src: '/User/path/to/certificate/key' },
cert: { src: '/User/path/to/certificate' },
passphrase: 'iampassphrase'
});
Upvotes: 1