scala-academy / castalia

API stub server
Other
8 stars 3 forks source link

As a stubserver consumer I want to be able to specify stub properties on a stub-level and overwrite these for specific stub responses #23

Closed jordi133 closed 8 years ago

jordi133 commented 8 years ago

Acceptance criteria:

background: given that the stubserver is started

given that I configured a stub with a property "delay" as constant 100 ms and I configured a specific response of that stub with id a property "delay" as constant 2 s when I get a response from that stub with an id different from then the latency of that response should be roughly 100 ms

given that I configured a stub with a property "delay" as constant 100 ms and I configured a specific response of that stub with id a property "delay" as constant 2 s when I get the response from that stub with id equal to then the latency of that response should be roughly 2 s

jordi133 commented 8 years ago

Example json:

{ "endpoint": "jsonconfiguredstub", "delay": { "distribution": "constant", "mean": "100 ms" }, "responses": [ { "id": "1", "httpStatusCode": 200, "response": { "id": "een", "someValue": "123123" } }, { "id": "2", "httpStatusCode": 200, "response": { "id": "twee", "someValue": "123123", "someAdditionalValue": "345345" } }, { "id": "0", "delay": { "distribution": "constant", "mean": "2 s" }, "httpStatusCode": 404 } ] }

jeanmarc commented 8 years ago

Yordi, is it OK to implement this feature by creating a "default": { ... } response, which will hold the default properties? That makes it easy to also use a default httpStatusCode, and other future properties (the final result becomes a simple 'merge' of the default json with the response json).