Changed specification to rise an error when inserting with a negative index. Added new scenario to check this condition
This commit is contained in:
+3
-2
@@ -209,7 +209,7 @@ field must be a json scaped string.
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
* **Sample Call**: `$ curl $KAPOW_URL/routes`
|
* **Sample Call**: `$ curl $KAPOW_URL/routes`
|
||||||
* **Notes**: Currently all routes are returned; in the future, a filter may be
|
* **Notes**: Currently all routes are returned; in the future, a filter may be
|
||||||
accepted.
|
accepted.
|
||||||
|
|
||||||
|
|
||||||
@@ -314,10 +314,11 @@ A new id is created for the appended route so it can be referenced later.
|
|||||||
```
|
```
|
||||||
* **Notes**:
|
* **Notes**:
|
||||||
* Route numbering starts at zero.
|
* Route numbering starts at zero.
|
||||||
* When `index` is not provided or is less than `0` the route will be inserted
|
* When `index` is not provided or is `0` the route will be inserted
|
||||||
first, effectively making it index `0`.
|
first, effectively making it index `0`.
|
||||||
* Conversely, when `index` is greater than the number of entries on the route
|
* Conversely, when `index` is greater than the number of entries on the route
|
||||||
table, it will be inserted last.
|
table, it will be inserted last.
|
||||||
|
* Finally, when `index` is less than `0` a 422 error is raised.
|
||||||
* A successful request will yield a response containing all the effective
|
* A successful request will yield a response containing all the effective
|
||||||
parameters that were applied.
|
parameters that were applied.
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,21 @@ Feature: Kapow! server rejects insertion requests with semantic errors.
|
|||||||
"""
|
"""
|
||||||
Then I get 422 as response code
|
Then I get 422 as response code
|
||||||
And I get "Invalid Route" as response reason phrase
|
And I get "Invalid Route" as response reason phrase
|
||||||
|
|
||||||
|
Scenario: Error because negative index specified.
|
||||||
|
If a request contains a negative number in the
|
||||||
|
index field the server responds with an error.
|
||||||
|
|
||||||
|
Given I have a running Kapow! server
|
||||||
|
When I insert the route:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"url_pattern": "+123--",
|
||||||
|
"entrypoint": "/bin/sh -c",
|
||||||
|
"command": "ls -la / | response /body",
|
||||||
|
"index": -1
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
Then I get 422 as response code
|
||||||
|
And I get "Invalid Route" as response reason phrase
|
||||||
|
|||||||
Reference in New Issue
Block a user