val){ var key = field.toLowerCase()

时间:2022-03-25 07:51:05

打开你的依赖node_modules\karma\node_modules\connect\lib\patch.js

将里面的setHeader要领改成下面这样,干失序列化日期时呈现的中文

res.setHeader = function(field, val){ var key = field.toLowerCase() , prev; // special-case Set-Cookie if (key === ‘set-cookie‘) { // detect code doing getHeader -> setHeader if (Array.isArray(val) && val.length > 1) { prev = [].concat(this.getHeader(field) || []); val = unique(prev, val); } return this.appendHeader(field, val); } // charset if (‘content-type‘ == key && this.charset) { val = utils.setCharset(val, this.charset, true); } try{ if(typeof val === ‘string‘){ val = val.replace(/中国标准时间/,‘‘) } return setHeader.call(this, field, val); }catch(e){ console.log(e, val,field) } };

来由:https://www.cnblogs.com/rubylouvre/p/6127190.html?utm_source=tuicool&utm_medium=referral