Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated filter

  • Loading branch information...
commit 152ad2bd13acc8b4d4a096210b8c5b7833423c28 1 parent c82014e
@fehguy fehguy authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 Apps/petstore/main.js
View
6 Apps/petstore/main.js
@@ -28,13 +28,13 @@ app.use(express.bodyParser());
// Set the main handler in swagger to the express app
swagger.setAppHandler(app);
-// This is a sample validator. It simply says that for _all_ POST
+// This is a sample validator. It simply says that for _all_ POST, DELETE, PUT
// methods, the header `api_key` OR query param `api_key` must be equal
// to the string literal `special-key`. All other HTTP ops are A-OK
swagger.addValidator(
function validate(req, path, httpMethod) {
// example, only allow POST for api_key="special-key"
- if ("POST" == httpMethod) {
+ if ("POST" == httpMethod || "DELETE" == httpMethod || "PUT" == httpMethod) {
var apiKey = req.headers["api_key"];
if (!apiKey) {
apiKey = url.parse(req.url,true).query["api_key"]; }
@@ -74,4 +74,4 @@ app.get(/^\/docs(\/.*)?$/, function(req, res, next) {
});
// Start the server on port 8002
-app.listen(8002);
+app.listen(8002);
Please sign in to comment.
Something went wrong with that request. Please try again.