From 19a6d5c9e14a9544130ff2b4f4abfbe537e155c2 Mon Sep 17 00:00:00 2001 From: Brian Hurlow Date: Mon, 7 Nov 2016 21:07:33 -0500 Subject: [PATCH] before sending html, check if response is still open --- server/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/index.js b/server/index.js index d56ab30a111c0..0253a94650545 100644 --- a/server/index.js +++ b/server/index.js @@ -190,7 +190,9 @@ export default class Server { } function sendHTML (res, html) { - res.setHeader('Content-Type', 'text/html') - res.setHeader('Content-Length', Buffer.byteLength(html)) - res.end(html) + if (!res.finished) { + res.setHeader('Content-Type', 'text/html') + res.setHeader('Content-Length', Buffer.byteLength(html)) + res.end(html) + } }