-
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.
Fix update limitation for response body template
Implements #116
- Loading branch information
1 parent
d4bbed1
commit cee7290
Showing
9 changed files
with
94 additions
and
10 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
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
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
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,25 @@ | ||
When we request a GET to the server with uri '/validate', | ||
we will obtain a status code 200 if response is validated | ||
against this body (417 if not): | ||
|
||
{ | ||
"id": "test_2", | ||
"randoms": [ | ||
"2", "2" | ||
] | ||
} | ||
|
||
Traffic classification (matching configuration) will be simple, FullMatching, | ||
as the example is done for an static/constant and hence, predictable URI. | ||
|
||
Traffic behavior (provision configuration) will configure a response which | ||
depends on random number <R> between 1 and 5: | ||
|
||
{ | ||
"id": "test_<R>", | ||
"foo": "bar", | ||
"randoms": [ | ||
"<R>", "2" | ||
], | ||
"completed": true | ||
} |
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,4 @@ | ||
{ | ||
"method": "GET", | ||
"uri": "/validate" | ||
} |
3 changes: 3 additions & 0 deletions
3
tools/play-h2agent/examples/JsonConstraint/server-matching.json
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,3 @@ | ||
{ | ||
"algorithm":"FullMatching" | ||
} |
43 changes: 43 additions & 0 deletions
43
tools/play-h2agent/examples/JsonConstraint/server-provision.json
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,43 @@ | ||
{ | ||
"requestMethod": "GET", | ||
"requestUri": "/validate", | ||
"responseCode": 200, | ||
"responseBody": { | ||
"foo": "bar", | ||
"completed": true | ||
}, | ||
"transform": [ | ||
{ | ||
"source": "random.1.5", | ||
"target": "var.R" | ||
}, | ||
{ | ||
"source": "value.test_@{R}", | ||
"target": "response.body.json.string./id" | ||
}, | ||
{ | ||
"source": "value.[\"@{R}\", \"2\"]", | ||
"target": "response.body.json.jsonstring./randoms" | ||
}, | ||
{ | ||
"source": "response.body", | ||
"target": "var.expectedBody", | ||
"filter": { | ||
"JsonConstraint": { | ||
"id": "test_2", | ||
"randoms": [ | ||
"2", | ||
"2" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"source": "value.417", | ||
"target": "response.statusCode", | ||
"filter": { | ||
"ConditionVar": "!expectedBody" | ||
} | ||
} | ||
] | ||
} |