In scripting it would be nice to be able to persist state between a request and its response, maybe via the context object or something similar. For example for holding on to the original requests url something like this could work:
function onRequest(context, url, request) {
context.originalURL = url;
request.schema = 'http';
request.host = 'localhost';
request.port = 8080;
return request;
}
function onResponse(context, url, request, response) {
// at this point `url` will be the updated one "localhost"
// but context.originalURL would have the value of the original one.
console.log(context.originalURL)
return response;
}
this is a really simple example, but it would be useful to be able to reference state in onResponse that was derived inside onRequest
In scripting it would be nice to be able to persist state between a request and its response, maybe via the context object or something similar. For example for holding on to the original requests url something like this could work:
this is a really simple example, but it would be useful to be able to reference state in
onResponsethat was derived insideonRequest