Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix http api

  • Loading branch information...
commit e2a8f8d60b57220caa198e9389c9b58a77198df7 1 parent ee80c07
Alexis Sellier authored

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. +6 5 lib/journey.js
11 lib/journey.js
@@ -205,6 +205,8 @@ journey.Router.prototype = {
205 205 constraints: [],
206 206
207 207 validateRoute: function (route, request, body, allowedMethods, cb) {
  208 + var that = this;
  209 +
208 210 // Match the pattern with the url
209 211 var match = (function (pattern) {
210 212 var path = request.url.pathname;
@@ -244,6 +246,9 @@ journey.Router.prototype = {
244 246 if ((route.method.indexOf(request.method) !== -1) || !route.method) {
245 247 return cb(null, function (res, params) {
246 248 var args = [];
  249 +
  250 + if (that.options.api === 'http') { args.push(request) }
  251 +
247 252 args.push(res);
248 253 args.push.apply(args, match.slice(1).map(function (m) {
249 254 return /^\d+$/.test(m) ? parseInt(m) : m;
@@ -415,11 +420,7 @@ journey.Router.prototype = {
415 420 this.send = this.responder;
416 421
417 422 try {
418   - if (that.options.api === 'http') {
419   - destination.call(this, this.request, this, params || {});
420   - } else {
421   - destination.call(this, this, params || {});
422   - }
  423 + destination.call(this, this, params || {});
423 424 } catch (err) {
424 425 this.respond({
425 426 body: { error: err.message || err,

0 comments on commit e2a8f8d

Please sign in to comment.
Something went wrong with that request. Please try again.