-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ some fixes for rule handling and help page mapping.
- Loading branch information
Ishan Oshadi Jayawardene
committed
Sep 4, 2012
1 parent
0c8d63e
commit ccc91fc
Showing
3 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /bin/bash | ||
|
||
set -e -u | ||
|
||
readonly alecto=http://127.0.0.1:4567 | ||
|
||
# delete all | ||
curl -X DELETE $alecto/rules/all | grep 'All rules deleted' | ||
|
||
# add rule | ||
curl -X POST --data-binary @- $alecto/rules <<EOF | grep 'Rule added/updated' | ||
{ | ||
"number": 1, | ||
"description": "rule 1", | ||
"strings": [ "dead", "beef" ], | ||
"response": "pass1" | ||
} | ||
EOF | ||
|
||
# test that rule | ||
curl -X POST --data-binary @- $alecto/test <<< 0xdeadbeef | grep pass1 | ||
|
||
# add another rule to work on the query string | ||
curl -X POST --data-binary @- $alecto/rules <<EOF | grep 'Rule added/updated' | ||
{ | ||
"number": 2, | ||
"description": "Test query string matching", | ||
"query_strings": [ "dead", "beef" ], | ||
"response": "pass2" | ||
} | ||
EOF | ||
|
||
curl -X POST "$alecto/test?dead&beef&" | grep pass2 | ||
|
||
# GET | ||
curl "$alecto/test?dead&beef&" | grep pass2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters