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

Bambda that displays requests/responses between, before, or after a certain date/time #57

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Proxy/HTTP/ShowRequestsBetweenDates.bambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Shows Requests/Responses before, after, or between specified dates
*
* @author Nick Coblentz (https://github.com/ncoblentz)
*
**/

//The current configuration looks for requests/responses between January 19th, 2024 10:00AM US Central Time and January 19th, 2024 10:10AM US Central Time
//Change the date/time to the values you desire and your local timezone (https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#SHORT_IDS)
//The script accounts for 'null' values. Replace the before or after variables with null to search just before or just after a certain date/time.

ZonedDateTime requestsAfterThisDate = ZonedDateTime.of(LocalDateTime.of(2024, 1, 19, 10, 0), ZoneId.of("America/Chicago")); // or null
ZonedDateTime requestsBeforeThisDate = ZonedDateTime.of(LocalDateTime.of(2024, 1, 19, 10, 10), ZoneId.of("America/Chicago")); // or null

boolean afterCheck = true;
boolean beforeCheck = true;

if (requestsAfterThisDate != null)
{
afterCheck = requestResponse.time().isAfter(requestsAfterThisDate);
}

if (requestsBeforeThisDate != null)
{
beforeCheck = requestResponse.time().isBefore(requestsBeforeThisDate);
}

return afterCheck && beforeCheck;