Closed apichick closed 8 years ago
Hi, thanks for bringing up this issue. Can you please clarify your scenario, and what you'd like to see? Looks like you've set up a switch, and you want to return a 401 reponse, with no body, if there's no match for the request? Is that right? Also, please see issue #65 which is related.
Yes, I have the following
"verify": { "verbs": [ "post" ], "switch": [ "customerId" ], "responses": { "post": { "httpStatus": 401 } }, "switchResponses": { "customerId1234": {"httpStatus": 200, "mockFile": "customerAuthorised.json" }, "customerId5678": {"httpStatus": 200, "mockFile": "customerAuthorised.json" } } }
Issue #65 is related, but it only offers support for 404 status code. It would be good to be able to return any status code, the one configured in responses/httpStatus
Fixed in v0.4.16.
I cannot set a default response that only has httpStatus and no body:
"responses": { "post": {"httpStatus": 401 } }
I get the following error
/Users/myuser/Projects//mock-api/apiproxy/resources/node/node_modules/apimocker/lib/apimocker.js:394 mockFileParts = options.mockFile.split("/"); ^
TypeError: Cannot read property 'split' of undefined at Object.apiMocker.setSwitchOptions (/Users/miren/Projects/mock-api/apiproxy/resources/node/node_modules/myuser/lib/apimocker.js:394:35) at Timeout._onTimeout (/Users/myuser/Projects/mock-api/apiproxy/resources/node/node_modules/apimocker/lib/apimocker.js:231:17) at tryOnTimeout (timers.js:224:11) at Timer.listOnTimeout (timers.js:198:5)