From 3d39836cfb9f7cfb29f262d8985e9bc518669d50 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 25 Aug 2018 09:12:06 -0400 Subject: [PATCH] prevent deprecation warnings --- src/middleware.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middleware.ts b/src/middleware.ts index cd3bf94c8..32330613e 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -217,7 +217,7 @@ function get_server_route_handler(routes: ServerRoute[]) { // intercept data so that it can be exported res.write = function(chunk: any) { - chunks.push(new Buffer(chunk)); + chunks.push(Buffer.from(chunk)); write.apply(res, arguments); }; @@ -227,7 +227,7 @@ function get_server_route_handler(routes: ServerRoute[]) { }; res.end = function(chunk?: any) { - if (chunk) chunks.push(new Buffer(chunk)); + if (chunk) chunks.push(Buffer.from(chunk)); end.apply(res, arguments); process.send({