0

I would like to use a postman pre-fetch script to refresh my app secret from an api protected by aws signature. I am able to make a basic authentication like this. However I need an aws signature authentication


var url = "https://some.endpoint"
var auth = {
  type: 'basic',
  basic: [
    { key: "username", value: "postman" },
    { key: "password", value: "secrets" }
  ]
};

var request = {
    url: url,
    method: "GET",
    auth: auth
}

pm.sendRequest(request, function (err, res) {
    const json = res.json() // Get JSON value from the response body 
    console.log(json)
});
Nic Wanavit
  • 2,363
  • 5
  • 19
  • 31

1 Answers1

0

hi just create a normal postman request that work properly and then copy that request to a variable by adding the below line in test script

 pm.environment.set("awsrequest", pm.request)

Now you can use the awsrequest variable to send use in pm.sendRequest

 pm.sendRequest(pm.environment.get("awsrequest"))
PDHide
  • 18,113
  • 2
  • 31
  • 46