-
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 restructuring, passthrough mode and direct mode implemented.
- Loading branch information
Showing
3 changed files
with
135 additions
and
8 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 |
---|---|---|
@@ -1,3 +1,46 @@ | ||
// vim:set ts=8 sts=8 sw=8 noet ai ff=unix: | ||
|
||
A Sinatra + JRuby app to mock simple http services. | ||
|
||
Just a prototype. | ||
|
||
|
||
Match Behaviour: | ||
|
||
Rules may contain various JSON object keys which control how the | ||
rules behave. | ||
|
||
Rules must contain a key named "strings", which must be a JSON | ||
array of strings. All the strings specified here must be present | ||
in the request entity (POST body). | ||
Special case: If the list has only item, the string "default", this | ||
is taken to mean a positive match. | ||
|
||
Response data for a given request may be provided directly in the | ||
JSON, if specified as the value of a key named "response". | ||
|
||
A response can be kept in a file and its name may be referenced as | ||
the value of a key named "file". | ||
Note that such files should be in UTF-8. | ||
|
||
A rule may have a key named "service", with its value being a URI | ||
to a http service. In this case, the request will be POSTed to that | ||
service, and its response will be sent back to the client. | ||
|
||
The existence of these keys are checked in the above order. | ||
|
||
For "response" and "file", the JSON should contain a key named | ||
"content_type" that specifies a valid MIME type. | ||
|
||
Any rule may contain a key named "path_info". If specified, the | ||
path_info used when POSTing to Alecto must end with the value of | ||
"path_info" specified in the rule. | ||
If path_info is specified in a rule, but does not match the | ||
path_info in the http request, the match is considered to have | ||
failed. Note that this occurs before the body content string | ||
comparison. | ||
|
||
Combined with "default", "path_info" can be used to set up a real | ||
service to serve most requests, leaving us free to intercept the | ||
(hopefully few) requests we are interested in. | ||
|
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