-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to abort a request? #772
Comments
var r = request(url)
r.abort() We should get this in to the documentation. |
Thanks for the reply @mikeal, I tried this: var theRequest = request({
'method' : 'GET',
'url': '/anotherUrl',
'headers' : {
"ACCEPT" : "text/event-stream"
}
}, function (error, response, body){
if (error) {
//Handle error
}
}).pipe(parser);
theRequest.abort(); And this error raises: /home/vagrant/gateway/app.js:876
theRequest.abort();
^
TypeError: Object #<ServerResponse> has no method 'abort'
at IncomingMessage.<anonymous> (/home/vagrant/gateway/app.js:876:18)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at abortIncoming (http.js:1912:11)
at Socket.socket.onend (http.js:2010:7)
at Socket.g (events.js:180:16)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13) Could you help me please? Thank you! |
From the docs:
so you are no longer working with a var theRequest = request({ ... });
theRequest.pipe(parser);
theRequest.abort(); |
Thanks a lot! |
Closed
Thanks a lot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had been trying to abort a request for hours, can anyone help me please?
This is what I have:
As you can see its kinda a streaming proxy, so if clients cancels the request I catch it and need to close or abort the forwarding request (
theRequest
).Any ideas?
Thanks!
The text was updated successfully, but these errors were encountered: