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

When csrfToken() method is called? #56

Closed
efkan opened this issue Feb 18, 2015 · 2 comments
Closed

When csrfToken() method is called? #56

efkan opened this issue Feb 18, 2015 · 2 comments
Assignees
Labels

Comments

@efkan
Copy link

efkan commented Feb 18, 2015

Hello,

I had arranged a middleware to allow a certain route to pass without csrf examine like the below. Now, I've been trying to get rid of this error message: [TypeError: Object #<incomingMessage> has no method 'csrfToken'] . Because of this error my response status is set as 500 (internal server error).

I was wondering how can I obstruct being called csrfToken() ?

var csrf = csurf()
app.use(function (req, res, next) {
    if (req.path == '/test') return next()        
    csrf(req, res, next)          
}) 
@dougwilson
Copy link
Contributor

Hi! That method is never called by this module, rather it is called by your own code. If you can print out the stack trace for that error, it will point to the line number and which one of your files is calling it.

@efkan
Copy link
Author

efkan commented Feb 19, 2015

Oh my bad!
I didn't know but I learned how to print out stack trace.
And I had forgotten that I called the method in another middleware.
And I've taken your time two times.
I'm sorry and thank you!

@dougwilson dougwilson self-assigned this Feb 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants