forked from stoplightio/prism
-
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.
feat(http): generate an empty response if no matching response if fou…
…nd for chaos
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
====test==== | ||
Given I mock and specify a missing error code for chaos | ||
When I send a request to an operation | ||
Then the response should be blank with that status code | ||
====spec==== | ||
openapi: "3.1.0" | ||
info: | ||
version: "0.0" | ||
title: Config Test | ||
paths: | ||
/pets/{petId}: | ||
get: | ||
description: Get a pet by ID | ||
responses: | ||
"200": | ||
description: A pet | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
====config==== | ||
{ | ||
"chaos": { | ||
"enabled": true, | ||
"rate": 100, | ||
"codes": [401] | ||
} | ||
} | ||
====server==== | ||
mock -p 4010 --config ${config} ${document} | ||
====command==== | ||
curl -i http://localhost:4010/pets/2 | ||
====expect==== | ||
HTTP/1.1 401 Unauthorized | ||
Content-Length: 0 |