Skip to content

Commit

Permalink
Merge e916cd3 into 9270602
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Mar 1, 2015
2 parents 9270602 + e916cd3 commit 80d083a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 1 addition & 4 deletions lib/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ module.exports = function (options) {
var validate = impl.validate || _impl.validate;
var _token = _impl.token || _impl;
// Set the token
if (!this.locals) {
this.locals = {};
}
this.locals[key] = _token;
this.state[key] = _token;

// Move along for safe verbs
var method = this.method;
Expand Down
14 changes: 7 additions & 7 deletions test/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('CSRF', function () {

app.get('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

Expand All @@ -44,13 +44,13 @@ describe('CSRF', function () {

app.get('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

app.post('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

Expand Down Expand Up @@ -85,7 +85,7 @@ describe('CSRF', function () {

app.all('/csrf', function* () {
this.body = {
token: this.locals.foobar
token: this.state.foobar
};
});

Expand All @@ -107,7 +107,7 @@ describe('CSRF', function () {
var app = mock({ csrf: true });
app.all('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

Expand Down Expand Up @@ -136,7 +136,7 @@ describe('CSRF', function () {

app.all('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

Expand Down Expand Up @@ -166,7 +166,7 @@ describe('CSRF', function () {

app.all('/csrf', function* () {
this.body = {
token: this.locals._csrf
token: this.state._csrf
};
});

Expand Down

0 comments on commit 80d083a

Please sign in to comment.