From b75369c1a013b504289aac6bbd3ab187ad9c054f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=BE=BD=E9=A3=9E?= Date: Fri, 16 Dec 2016 15:17:46 +0800 Subject: [PATCH] fix unsafe header It will throw exception when call `.setHeader` manauly. --- lib/request.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/request.js b/lib/request.js index 7b8b733..afbb442 100644 --- a/lib/request.js +++ b/lib/request.js @@ -77,6 +77,7 @@ var Request = module.exports = function (xhr, params) { inherits(Request, Stream); Request.prototype.setHeader = function (key, value) { + if (!this.isSafeRequestHeader(key)) return; this._headers[key.toLowerCase()] = value };