Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix http api

  • Loading branch information...
commit e2a8f8d60b57220caa198e9389c9b58a77198df7 1 parent ee80c07
Alexis Sellier authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/journey.js
11 lib/journey.js
View
@@ -205,6 +205,8 @@ journey.Router.prototype = {
constraints: [],
validateRoute: function (route, request, body, allowedMethods, cb) {
+ var that = this;
+
// Match the pattern with the url
var match = (function (pattern) {
var path = request.url.pathname;
@@ -244,6 +246,9 @@ journey.Router.prototype = {
if ((route.method.indexOf(request.method) !== -1) || !route.method) {
return cb(null, function (res, params) {
var args = [];
+
+ if (that.options.api === 'http') { args.push(request) }
+
args.push(res);
args.push.apply(args, match.slice(1).map(function (m) {
return /^\d+$/.test(m) ? parseInt(m) : m;
@@ -415,11 +420,7 @@ journey.Router.prototype = {
this.send = this.responder;
try {
- if (that.options.api === 'http') {
- destination.call(this, this.request, this, params || {});
- } else {
- destination.call(this, this, params || {});
- }
+ destination.call(this, this, params || {});
} catch (err) {
this.respond({
body: { error: err.message || err,
Please sign in to comment.
Something went wrong with that request. Please try again.