Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCRIPTING] Shared State in Environment Variables #407

Open
kics223w1 opened this issue May 16, 2024 · 0 comments
Open

[SCRIPTING] Shared State in Environment Variables #407

kics223w1 opened this issue May 16, 2024 · 0 comments
Assignees
Labels
✅ Done Ticket is resolved enhancement New feature or request

Comments

@kics223w1
Copy link

Description

Acceptance Criteria

  • Get the global counter and increase it as soon as the script is executed
  • Share data between Request and Response
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;
}
@kics223w1 kics223w1 added the enhancement New feature or request label May 16, 2024
@kics223w1 kics223w1 self-assigned this May 16, 2024
@kics223w1 kics223w1 moved this from In progress to PR in Review in Proxyman Windows/Linux development May 16, 2024
@kics223w1 kics223w1 added the ✅ Done Ticket is resolved label May 17, 2024
@kics223w1 kics223w1 moved this from PR in Review to Done in Proxyman Windows/Linux development May 17, 2024
@NghiaTranUIT NghiaTranUIT added this to the Proxyman 2.15.0 milestone Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Done Ticket is resolved enhancement New feature or request
Development

No branches or pull requests

2 participants