Wiiremock http失败错误
Posted
技术标签:
【中文标题】Wiiremock http失败错误【英文标题】:Wiiremock http fail errors 【发布时间】:2018-06-27 20:39:46 【问题描述】:我为 Jmeter 中负载测试的 HTTP 请求编写了以下 Wiremock 代码:
当我在 eclipse 中运行它时出现以下错误:
谁能帮我解决这个问题?
【问题讨论】:
还有问题吗? 什么代码?..... 【参考方案1】:您指定了两个不同的端口号 8081、8080
wiremock 将只在指定端口上运行,下面的代码适用于 localhost:8080/abc/xyz
package com.wiremock;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import
com.github.tomakehurst.wiremock.stubbing.StubMapping;
import static
com.github.tomakehurst.wiremock.client.WireMock.*;
public class WireMockMain
public static void main(String[] args)
// TODO Auto-generated method stub
WireMockServer wireMockServer = new WireMockServer(8080);
//configureFor("localhost", 8081);
wireMockServer.start();
StubMapping foo = WireMock.stubFor(get(urlPathEqualTo("/abc/xyz"))
.willReturn(aResponse()
.withStatus(200)
.withBody("\"message\": \"Hello World\"")));
wireMockServer.addStubMapping(foo);
【讨论】:
以上是关于Wiiremock http失败错误的主要内容,如果未能解决你的问题,请参考以下文章
错误:升级失败:错误验证“”:错误验证数据:ValidationError(Ingress.spec.rules[0].http):缺少必填字段“路径”
HTTP 请求失败! HTTP/1.1 505 HTTP 版本不支持错误