【发布时间】:2018-05-15 22:36:56
【问题描述】:
如何为以下类型的 url 构建 nock 配置
http://example.com/harry/potter?param1=value1
和
http://example.com/harry/<value1>
我有两种类型的 url,首先是我可以有查询参数,尽管基本 url 是固定的。
第二个是基本 url 具有动态值的位置。
目前我有
before(function(){
nock('http://example.com')
.get('/terminal/chrome_log')
.reply(200, "OK");
nock('http://example.com')
.get(function(uri) {
return uri.indexOf('harry') >= 0;
})
.reply(200, "OK");
});
了解一些适用于节点诺克的知识会很有帮助。
【问题讨论】: