Last active
April 11, 2023 09:04
-
-
Save icemilo/49426240b6e1e998655e32d34fa675b6 to your computer and use it in GitHub Desktop.
Pre-Request Script for Ncloud API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const accessKey = pm.environment.get("accessKey") | |
const secret = pm.environment.get("secret") | |
const moment = require('moment'); | |
const timestamp = moment().valueOf(); | |
const message = pm.request.method + " " + pm.request.url.getPath() + "?" + pm.request.url.getQueryString() + "\n" + timestamp + "\n" + accessKey | |
const signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(message, secret)); | |
pm.collectionVariables.set("currentTimestamp", timestamp); | |
pm.collectionVariables.set("signature", signature); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment