【发布时间】:2016-10-20 13:54:45
【问题描述】:
我在节点中使用带有“请求”功能的 https 模块。每当它被调用时,它都会发送一个响应。它会向下面的 onject 发出类似的响应
{
_readableState: {
},
readable: true,
domain: null,
_events: {
},
_maxListeners: undefined,
socket: {},
connection: {},
httpVersionMajor: null,
httpVersionMinor: null,
httpVersion: null,
complete: false,
headers: {
'content-type': 'application/json'
},
rawHeaders: [
]
}
我必须从其中动态删除“标题”。我该怎么做?我正在使用 nock 进行单元测试,我可以通过 .reply 方法将标题设置为第三个参数(.reply(200, {}, {//header})) ,但不幸的是不能删除该标签本身。请帮帮我。
【问题讨论】:
标签: node.js https httprequest sinon