Created
March 2, 2015 20:04
-
-
Save MrLeebo/4c38a2af5afa5e8e09b8 to your computer and use it in GitHub Desktop.
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
curl "http://localhost:3000/pets" --data "baz=" |
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
var restify = require('restify'); | |
var app = restify.createServer(); | |
var swaggerTools = require('swagger-tools'); | |
swaggerTools.initializeMiddleware(require('./swagger'), function(middleware) { | |
// restify parses the post body into params | |
app.use(restify.bodyParser()); | |
// request gets stuck trying to re-parse body stream | |
app.use(middleware.swaggerMetadata()); | |
// we never get this far | |
app.post('/pets', function(req, res, next) { | |
res.send(req.swagger); | |
next(); | |
}); | |
var server = app.listen(3000, function() { | |
console.log("App started on port 3000.") | |
}); | |
}); |
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
EXPECTED: 200 Success | |
ACTUAL: 504 Gateway time-out |
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
module.exports = { | |
swagger: "2.0", | |
info: { | |
title: "title", | |
description: "desc", | |
version: "0.0.0" | |
}, | |
paths: { | |
"/pets": { | |
post: { | |
operationId: "post", | |
parameters: [ | |
{ name: "foo", in: "formData", type: "number" }, | |
], | |
responses: { | |
default: { | |
description: "Success" | |
} | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment