Environment Variables
1. Shared State
function onRequest(context, url, request) {
// Save some state to sharedState
sharedState.url = url;
sharedState.data = "custom";
sharedState.info = {"username": "Proxyman"};
// Increase the global counter
var count = sharedState.count ?? 0;
count += 1;
sharedState.count = count;
// Log
console.log(sharedState);
return request;
}
function onResponse(context, url, request, response) {
// Receive it
console.log("Custom data = " + sharedState.dataa);
console.log("sharedState.count = " + sharedState.count);
// Done
return response;
}2. Environment Variables
How to use

3. Additions
Last updated