我正在尝试使用 wireMock
作为独立进程来设置模拟服务器。我下载了 jar 文件并执行了以下命令:
java -jar wiremock-standalone-2.23.2.jar --port 0
我必须动态确定端口,因为我已经在我的计算机上运行的另一个程序使用默认的 8080 端口。它给了我端口号 55142,但是当我尝试在网络上访问该端口时,它给了我以下错误:
HTTP ERROR 403
Problem accessing /__files/. Reason:
Forbidden
Powered by Jetty://
最佳答案
这可能是由于您刚刚输入 http://localhost:55142
并且由于 ./mappings
目录中没有映射,而 ./files 目录中没有文件(与您的wiremock.jar 文件所在的位置相同)
2019-06-04 00:10:58.890 Request was not matched as there were no stubs registered:
{
"url" : "/"
...
}
请尝试使用__admin
端点调用以查看WireMock是否正常工作
http://localhost:55142/__admin
另请参阅文档 here更多好的管理命令。
关于jar - 作为独立运行 WireMock 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56384983/