apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
702 stars 371 forks source link

Mock routes should set response statusCode #269

Closed theganyo closed 9 years ago

theganyo commented 9 years ago

Specific case: Hapi appears to not set status code to 200 automatically (apparently the other frameworks do). Since swagger-tools validator relies on statusCode being set (swagger-validator.js:224:41), it should ensure that it explicitly sets statusCode when sending responses.

See: https://github.com/swagger-api/swagger-node/issues/277

whitlockjc commented 9 years ago

You're right, we should be explicitly setting res.statusCode when we render the mock response. Since we fail to do that, and Hapi doesn't do it for us, we break the response validation code which assume res.statusCode is set.

whitlockjc commented 9 years ago

swagger-tools@0.9.4 has been released with this fix.