At what point does accessing the request become unsafe? #84
-
I am running into the error Right now, I am actually getting the error while still in the request handler. I am not completely sure, but it seems like I lose access to the request once I call I modified the JsonPost example to use a promise rather than the callback pattern and was able to reproduce it -- here is gist that demonstrates the behavior that I am experiencing Also I am using v15.5 currently and node 10.14.1. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Await is technically a return. The async function is technically split in two actual functions; the first part up until await and the continuation is technically its own separate function. |
Beta Was this translation helpful? Give feedback.
-
Easiest rule of thumb is to just read all headers you need, at the top of the function: let userAgent = req.getHeader('user-agent'); Then forget about the req and only use userAgent. |
Beta Was this translation helpful? Give feedback.
Easiest rule of thumb is to just read all headers you need, at the top of the function:
let userAgent = req.getHeader('user-agent');
Then forget about the req and only use userAgent.