Skip to content

Commit

Permalink
Update HighlightListenerPort.bambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogo-6 authored Feb 22, 2024
1 parent 6766293 commit 0d27cf6
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions Proxy/HTTP/HighlightListenerPort.bambda
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@

boolean manualColorHighlightEnabled = true;

var listenerPort = requestResponse.listenerPort();
var colorMap = Map.of(
8080, HighlightColor.BLUE,
8082, HighlightColor.YELLOW
);
var notesMap = Map.of(
8080, "User 1",
8082, "User 2"
);


if (listenerPort == 8080) {
if (manualColorHighlightEnabled){
requestResponse.annotations().setHighlightColor(HighlightColor.BLUE);
var listenerPort = requestResponse.listenerPort();
var color = colorMap.get(listenerPort);
var notes = notesMap.get(listenerPort);

//Optionally, add a note to the request.
requestResponse.annotations().setNotes("User 1");
}
return true;
if (manualColorHighlightEnabled && color != null) {
requestResponse.annotations().setHighlightColor(color);
}

if (listenerPort == 8082) {
if (manualColorHighlightEnabled){
requestResponse.annotations().setHighlightColor(HighlightColor.YELLOW);

//Optionally, add a note to the request.
requestResponse.annotations().setNotes("User 2");
}
return true;
if (manualColorHighlightEnabled && notes != null) {
requestResponse.annotations().setNotes(notes);
}

return false;
return color != null || notes != null;

0 comments on commit 0d27cf6

Please sign in to comment.