Last active
September 2, 2020 12:13
-
-
Save mittsh/b50f2d8190d3434e7aad5f02db7a6c27 to your computer and use it in GitHub Desktop.
Access the (constant) header from a request in Paw
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
// context docs: https://paw.cloud/docs/reference/ExtensionContext | |
// request docs: https://paw.cloud/docs/reference/Request | |
// http exchange docs: https://paw.cloud/docs/reference/HTTPExchange | |
function evaluate(context){ | |
// get the request we're interested in | |
var request = context.getRequestByName('Request') | |
// get the last "HTTP Exchange" (request sending) | |
var lastExchange = request.getLastExchange() | |
// get the UUID from the header | |
var uuid = lastExchange.getRequestHeaderByName('X-UUID') | |
// return and use that UUID | |
// it will stay constant until the initial request "Request" is being sent again | |
return uuid; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment