[英]Wiremock problem with ignore requests except one
I have problem with ignore all requests except one.我有忽略除一个之外的所有请求的问题。 I have the code that I need to intercept the desired request, but before that I must skip all the other requests to the server.我有拦截所需请求所需的代码,但在此之前我必须跳过所有其他对服务器的请求。 How can i do this?我怎样才能做到这一点?
givenThat(any(anyUrl()).withHeader("SOAPAction", equalTo("\"Mystifly.OnePoint/OnePoint/AirRevalidate\""))
.willReturn(aResponse().withStatus(200)
.withBody("{ \"message\": \"Roma Barladyn - a great colleague!\" }")
));
I also tried that but I get empty body of response, how I can send body which I get from server?我也尝试过,但我得到了空的响应体,我如何发送从服务器获得的正文?
givenThat(any(anyUrl()).atPriority(100).willReturn(aResponse()));
If you need to make sure that you check the desired request first, you can add it at the highest priority .如果您需要确保首先检查所需的请求,您可以将其添加到最高优先级。 Priority 1 will get checked before Priority 2, get checked before Priority 3, and so on.优先级 1 将在优先级 2 之前进行检查,在优先级 3 之前进行检查,依此类推。 So Priority 100 in your example will get checked after Priorities 1 through 99.因此,您的示例中的优先级 100 将在优先级 1 到 99 之后进行检查。
givenThat(any(anyUrl())
.atPriority(1)
.withHeader("SOAPAction", equalTo("\"Mystifly.OnePoint/OnePoint/AirRevalidate\""))
.willReturn(aResponse().withStatus(200)
.withBody("{ \"message\": \"Roma Barladyn - a great colleague!\" }")
));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.