Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Allow swagger 'action' functions to access next() from Express. #84

Merged
merged 1 commit into from Dec 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/node/swagger.js
Expand Up @@ -373,7 +373,7 @@ function addMethod(app, callback, spec) {
var fullPath = spec.path.replace(formatString, jsonSuffix).replace(/\/{/g, "/:").replace(/\}/g, "");
var currentMethod = spec.method.toLowerCase();
if (allowedMethods.indexOf(currentMethod) > -1) {
app[currentMethod](fullPath, function (req, res) {
app[currentMethod](fullPath, function (req, res, next) {
exports.setHeaders(res);

// todo: needs to do smarter matching against the defined paths
Expand All @@ -385,7 +385,7 @@ function addMethod(app, callback, spec) {
}), 403);
} else {
try {
callback(req, res);
callback(req, res, next);
} catch (error) {
if (typeof errorHandler === "function") {
errorHandler(req, res, error);
Expand Down