swagger-tools
                                
                                
                                
                                    swagger-tools copied to clipboard
                            
                            
                            
                        Mock responses for some definitions always return with 200 status
Hi, thanks for this project!
I'm running into an issue with swagger router running in mock mode.
I have some definitions that have PUT and POST methods that should return a 204 status according to their definitions, but the mock response comes back with a status of 200.
It looks like this is intentionally done here: https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-router.js#L280 where the status will only get set to 204 for requests with a DELETE method. Other requests get set to a default of 200.
I can't find any information about why 204 responses aren't allowed for PUT/POST requests, so is this a case that can be added? I'm happy to submit a PR.
Thanks!
This is just how the mock functionality was written. The mocking support was just an initial pass with no input from anyone else. We could potentially just use some convention for identifying which response to use instead of hard coding them.
How about just returning the first 2XX status? I've done that here which seems to work. If you're ok with that approach I'm happy to make a PR with some tests/updated docs.