@SpringBootApplication
public class WiremockDemoApplication implements CommandLineRunner {
private WireMockServer wireMockServer;
public static void main(String[] args) {
SpringApplication.run(WiremockDemoApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
wireMockServer = new WireMockServer(options()
.port(8090));
wireMockServer.start();
wireMockServer.stubFor(get(urlPathEqualTo("/bind-test"))
.willReturn(aResponse()
.withBodyFile("stub_1.json")
.withHeader("header1", "poks")
//.withBody("heipta")
.withStatus(200)));
}
}
返回错误:
com.github.tomakehurst.wiremock.admin.NotFoundException: Not found in blob store: stub_1.json
什么是“blob 商店”。我无法从文档中找到它。
我应该将存根文件放在哪里?在此示例中为“stub_1.json”。
读取文本文件并将其粘贴到“withBody(“xxx”)