上一篇中对
stubs
配置做了介绍,该篇对imposter
和stubs
在上一篇中没有提及的配置进行简短的介绍,该篇内容并不多。
配置多个imposter
前篇中的示例都是在imposters.ejs
文件中配置了一个imposter
,mb
在启动时是可以加载多个imposter
的,并且可以加载外部文件,配置如下:
{
"imposters": [
<% include ./imposter1.json %>,
<% include ./imposter2.json %>,
<% include ./imposter3.json %>
]
}
imposter1.json imposter2.json imposter3.json
三个文件代表了三个imposter
的配置, 文件内容示例:
{
"port": 4545,
"protocol": "http",
"stubs": [{
"predicates": [{
"equals": {
"path": "/test",
"method": "POST",
"headers": { "Content-Type": "application/json" }
}
}],
"responses": [
{ "is": {