Skip to content

Instantly share code, notes, and snippets.

@mark05e
Created June 25, 2022 19:38
Show Gist options
  • Save mark05e/ac9b0afa42dd9d40dd961847d8fb6cf4 to your computer and use it in GitHub Desktop.
Save mark05e/ac9b0afa42dd9d40dd961847d8fb6cf4 to your computer and use it in GitHub Desktop.
// from https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-app-configuration/rest-api-postman.md
// TODO: Replace the following placeholders with your access key
var credential = "<Credential>"; // Id
var secret = "<Secret>"; // Value
var isBodyEmpty = pm.request.body === null || pm.request.body === undefined || pm.request.body.isEmpty();
var headers = signRequest(
pm.request.url.getHost(),
pm.request.method,
pm.request.url.getPathWithQuery(),
isBodyEmpty ? undefined : pm.request.body.toString(),
credential,
secret);
// Add headers to the request
headers.forEach(header => {
pm.request.headers.upsert({key: header.name, value: header.value});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment