From 0876ca25a20724bd72880ea0bc9d31d55ddd3790 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 7 Apr 2021 00:03:04 -0500 Subject: [PATCH] fix: header guard --- packages/http/src/http.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/http/src/http.js b/packages/http/src/http.js index 4be6ede..9867b32 100644 --- a/packages/http/src/http.js +++ b/packages/http/src/http.js @@ -68,7 +68,9 @@ export const createHttpServer = async (latus) => { res.statusCode = proxyRes.statusCode; if ('text/html; charset=UTF-8' === proxyRes.headers['content-type']) { requestMiddleware(req, res, () => { - res.setHeader('Content-Type', proxyRes.headers['content-type']); + if (!res.headersSent) { + res.setHeader('Content-Type', proxyRes.headers['content-type']); + } proxyRes.pipe(res); }); }