Skip to content

Commit

Permalink
Utilizing req.allows in this.respond()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Nov 25, 2014
1 parent bcd614f commit 363ead8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 0.9.27
- Utilized `req.allows` in `this.respond()`

## 0.9.26
- Fixed `this.respond()` by passing a required parameter to `this.server.allows()`

Expand Down
8 changes: 4 additions & 4 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* @license BSD-3 <https://raw.github.com/avoidwork/tenso/master/LICENSE>
* @link http://avoidwork.github.io/tenso
* @module tenso
* @version 0.9.26
* @version 0.9.27
*/
( function () {
"use strict";

var turtleio = require( "turtle.io" ),
SERVER = "tenso/0.9.26",
SERVER = "tenso/0.9.27",
CONFIG = require( __dirname + "/../config.json" ),
keigai = require( "keigai" ),
util = keigai.util,
Expand Down Expand Up @@ -65,7 +65,7 @@ function Tenso () {
this.rates = {};
this.server = turtleio();
this.server.tenso = this;
this.version = "0.9.26";
this.version = "0.9.27";
}

/**
Expand Down Expand Up @@ -184,7 +184,7 @@ Tenso.prototype.respond = function ( req, res, arg, status, headers ) {
}
}

if ( REGEX_MODIFY.test( this.server.allows( req.parsed.pathname, req.vhost, false ) ) ) {
if ( REGEX_MODIFY.test( req.allows ) ) {
if ( this.server.config.security.csrf && res.locals[ this.server.config.security.key ] ) {
ref[ 0 ][ "x-csrf-token" ] = res.locals[ this.server.config.security.key ];
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is a REST API facade for node.js, designed to simplify the implementation of APIs.",
"version": "0.9.26",
"version": "0.9.27",
"homepage": "http://avoidwork.github.io/tenso",
"author": {
"name": "Jason Mulligan",
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"keigai": "~0.9.0",
"turtle.io": "~3.1.6",
"turtle.io": "~3.1.7",
"cookie-parser": "~1.3.3",
"express-session": "~1.8.2",
"passport": "~0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Tenso.prototype.respond = function ( req, res, arg, status, headers ) {
}
}

if ( REGEX_MODIFY.test( this.server.allows( req.parsed.pathname, req.vhost, false ) ) ) {
if ( REGEX_MODIFY.test( req.allows ) ) {
if ( this.server.config.security.csrf && res.locals[ this.server.config.security.key ] ) {
ref[ 0 ][ "x-csrf-token" ] = res.locals[ this.server.config.security.key ];
}
Expand Down

0 comments on commit 363ead8

Please sign in to comment.