So, as usual, I tried to find this question on SO, but still no luck.
I know that the answer is “Yes, you can change the req object”, but nothing is said about the parameters of the req object.
For example, the following code throws an error:
app.get('/search', function(req, res) { req.param('q') = "something"; });
Mistake:
ReferenceError: Invalid left-hand side in assignment
I suppose this has something to do with a property that does not have a “SET” method or something like that.
There are several scenarios where this may come in handy.
- A service that turns quick links into full-execution requests and proxies.
- Just change the settings before sending to another function that you do not want to change.
To the question, is there a way to change req object parameters?
Levi roberts
source share