scala-academy / castalia

API stub server
Other
8 stars 3 forks source link

As a stubserver consumer I want to be able to define stub behavior with multiple path parameters #20

Closed jordi133 closed 8 years ago

jordi133 commented 8 years ago

background: given that the stubserver is started and configured to use a stub called "doublepathparam" and that a stub config file with name "doublepathparam.json" is on the classpath

given that doublepathparam.json contains a property "endpoint" with value "doublepathparam/$1/responsedata/$2" and the responses in doublepathparam.json contain properties "$1" and "$2" when I do a HTTP GET to .../castalia/stubs/doublepathparam/{anyStubResponseId1}/responsedata/anyStubResponseId2 then I should get a HTTP 200 response containing the stub response with property "$1" equal to "{anyStubResponseId1}" and property "$2" equal to {anyStubResponseId2}

jordi133 commented 8 years ago

Example json:

{ "endpoint": "doublepathparam/$1/responsedata/$2", "responses": [ { "$1": "1", "$2": "id1", "httpStatusCode": 200, "response": { "id": "een", "someValue": "123123" } }, { "$1": "1", "$2": "id2", "httpStatusCode": 200, "response": { "id": "twee", "someValue": "123123", "someAdditionalValue": "345345" } }, { "$1": "0", "$2": "notfound", "httpStatusCode": 404 }, { "$1": "0", "$2": "internalerror", "httpStatusCode": 503 } ] }