Skip to content

--test: support METHOD URL (default GET)#35

Merged
ammario merged 10 commits intomainfrom
blink/test-method
Sep 12, 2025
Merged

--test: support METHOD URL (default GET)#35
ammario merged 10 commits intomainfrom
blink/test-method

Conversation

@blink-so
Copy link
Copy Markdown
Contributor

@blink-so blink-so Bot commented Sep 12, 2025

Follow-up to #30: extend --test to support METHOD URL in addition to URL (defaults to GET).

Changes:

  • Parse --test as one or two values ([METHOD] URL)
  • Accept two-arg form or a single quoted string (e.g., "POST https://example.com")
  • Method parsing is case-insensitive; falls back to GET on invalid
  • Output now includes the method: ALLOW <METHOD> <URL> or DENY <METHOD> <URL>
  • Tests added for both forms and case-insensitivity

Examples:

httpjail --js "r.host === 'google.com'" --test https://google.com
httpjail --js "r.method === 'POST' && r.host === 'example.com'" --test POST https://example.com
httpjail --js "r.method === 'PUT' && r.host === 'example.com'" --test "PUT https://example.com"

blink-so Bot added 3 commits September 11, 2025 20:21
…dd --test flag to CLI with URL argument\n- Build rule engine from --js/--js-file/--script and evaluate GET URL\n- Exit 0 on ALLOW, 1 on DENY; print result and optional context\n- Update clap to allow --test without a command\n- Add tests for allow/deny behavior\n\nFixes #30\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com>
…nused imports ArgAction and spawn_blocking\n- Apply rustfmt formatting changes\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com>
…RL" form (two args or quoted single arg)\n- Fallback to GET when method is omitted or invalid (case-insensitive)\n- Update help text and add tests\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com>
@ammario ammario marked this pull request as ready for review September 12, 2025 14:33
blink-so Bot and others added 7 commits September 12, 2025 14:58
…rate --test METHOD URL support\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com>
…ed-by: ammario <7416144+ammario@users.noreply.github.com>
…ammario <7416144+ammario@users.noreply.github.com>
Co-authored-by: ammario <7416144+ammario@users.noreply.github.com>
Co-authored-by: ammario <7416144+ammario@users.noreply.github.com>
Co-authored-by: ammario <7416144+ammario@users.noreply.github.com>
@ammario ammario merged commit 6690895 into main Sep 12, 2025
7 checks passed
@ammario ammario deleted the blink/test-method branch September 12, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant