After
I can not set a headers after they are sent
error when the escape After posting on the URL, try the driver for a (CasperJS) script. I have received many other posts about this issue with people running with XPE and have to send headers several times more goods. I just can not believe that this is related to how I am doing here. To send the request status, I have to do res.send
, right? Because if I do not have it, do not post the form.
Any ideas what I am doing wrong here?
app.post ('request' function (request, resolution) {// send callback res.send (req.status) (Verbose: true, LogLevel: 'debug', userAgent: 'Mozinta / 5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit / 537.22 (KHTML, like Lizard) Chrome / 25.0.1364.172 Safari / 537.22', PageSettings: {loadImages: false, loadPlugins: false}}); spooky.start ('http: //google.com', function () {this.echo (this.getTitle ());}); // Run scary Spooky.run ();}); itemprop = "text"> error "error: can not set the header after they are sent to
You have this res.send (req.status));
At the beginning of the callback and after that you are trying to do some more operations which are trying to set a header or status code but the body has already been written. So you see this error.
You should finally send the answer, more importantly, try to understand the asynchronous behavior of node.js.
move res.send (Req.status);
For the last line of the callback, your code will work.
No comments:
Post a Comment