Node.JS: What is the correct way to handle postdata read errors?

If the ServerRequest object emits an error event, that means that the postdata could not be fully received, most likely due to a network failure. This type of network failure is most likely terminal in both directions, right? So, how should I right my code?

I could say res.writeHead(400); res.end()

But is there a smarter way? Perhaps one that just 'does nothing', but will not result in a memory leak / hang. It seems like request.connection.destroy() is a good idea, but I am not sure if that is safe.

What would you recommend?

you don't need to do anything. internally, the socket/req/res will be destroyed. it'll be garbage collected eventually.

you don't need to send a response code - the connection is already destroyed so it's not going anywhere.