【发布时间】:2019-04-08 19:46:01
【问题描述】:
我正在使用 WireMock-Net 进行存根请求。
我想做以下请求:
请求:
http://localhost:63078/services/query/?q=SELECT Id from User where username='user@gmail.com'
请求由 SOQL 查询组成。 这是我尝试做的一个sn-p:
stub.Given(Request.Create()
.WithPath("/services/query/")
.WithParam("q", "SELECT Id from User where username='user@gmail.com'")
.UsingGet())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { Id = "5bdf076c-5654-4b3e-842c-7caf1fabf8c9" }));
问题是:wiremock 总是回复 404。我也尝试过使用 RegexMatcher,如下所示:
.WithPath("/services/query/")
.WithParam("q", new WireMock.Matchers.RegexMatcher("SELECT Id from User where username.*$"))
但我还是得到了 404。
我认为问题出在查询参数上,因为它有两个等号“=”。 有人可以帮我解决这个问题吗?
【问题讨论】: