proxyman-windows-linux
proxyman-windows-linux copied to clipboard
[Scripting] Color/Comment by Script
Description
⚠️ this ticket should be implemented after the #379
- The script can modify the comment and color
- Doc: https://docs.proxyman.io/scripting/snippet-code#comment-and-highlight-with-color
function onRequest(context, url, request) {
request.comment = "It's a Request"
request.color = "red" // red, blue, yellow, purple, gray, green
return request
}
function onResponse(context, url, request, response) {
response.comment = "It's a Response"
response.color = "yellow" // red, blue, yellow, purple, gray, green
return response
}
Acceptance Criteria
- [x] Support: Comment on flow.
- [x] Support: Color on flow. If the color doesn't match. For example:
request.color = "abc"-> Ignore it - [x] Write Unit Test for the Comment and Color logic -> Verify the flow in the FlowPool
how to test
- Make a script with the following script
///
async function onResponse(context, url, request, response) {
if (request.method == "GET") {
response.comment = "It's a GET Method"
response.color = "green"
} else if (request.method == "POST") {
response.comment = "It's a POST Method"
response.color = "yellow"
}
// Done
return response;
}
- Make some GET, POST, PUT requests
- Verify we have color and comment correctly
- For the PUT Request -> No Color or comment
- Export these requests to ProxymanLog -> Important again -> Verify the color is correct