From 1fd69b3e8785a5c88f0afa27ec9caa94e10b0fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=9A=E7=84=B6?= Date: Thu, 8 Feb 2018 22:42:30 +0800 Subject: [PATCH] stringify the error object in header --- lib/requestHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 9757fd6..57f2881 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -44,7 +44,7 @@ const getErrorResponse = (error, fullUrl) => { header: { 'Content-Type': 'text/html; charset=utf-8', 'Proxy-Error': true, - 'Proxy-Error-Message': error || 'null' + 'Proxy-Error-Message': error ? JSON.stringify(error) : 'null' }, body: requestErrorHandler.getErrorContent(error, fullUrl) }; @@ -116,7 +116,7 @@ function fetchRemoteResponse(protocol, options, reqData, config) { // set origin content length into header resHeader['x-anyproxy-origin-content-length'] = originContentLen; - + // only do unzip when there is res data if (ifServerGzipped && originContentLen) { refactContentEncoding();