This file contains hidden or 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 secretKey = pm.collectionVariables.get("apiSecretKey"); | |
| const method = pm.request.method.toUpperCase(); | |
| const fullUrl = pm.variables.replaceIn(pm.request.url.toString()); | |
| const url = new URL(fullUrl); | |
| const path = url.pathname; | |
| const body = pm.request.body?.raw || ""; | |
| const dataToSign = `${method}\n${path}\n${body}`; | |
| const signature = CryptoJS.HmacSHA256(dataToSign, secretKey) |