apigee-127 / swagger-node-runner

The heart of Swagger-Node
MIT License
102 stars 123 forks source link

Use default response for mock if statusCode response not available #120

Closed penx closed 6 years ago

penx commented 6 years ago

Further to apigee-127/sway/issues/166

I think that the following lines:

https://github.com/theganyo/swagger-node-runner/blob/7f85797e74ee8a182ae9458ac8e2eb4db9c7a6c3/fittings/swagger_router.js#L120

Mean that, if a 200 statusCode is requested, but the spec does not explicitly list a 200 response, the mock does not use the default.

Instead I think this should read:

      var response  = operation.getResponse(statusCode) || operation.getResponse('default');
      var mock = response.getExample(mimetype);