Jos*_*aio 5 c# wiremock .net-core
我正在使用WireMock-Net来存根请求。
我要执行以下请求:
请求:
http://localhost:63078/services/query/?q=SELECT Id from User where username='user@gmail.com'
Run Code Online (Sandbox Code Playgroud)
该请求由SOQL查询组成。这是我尝试做的一小段:
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" }));
Run Code Online (Sandbox Code Playgroud)
问题是:wiremock总是以404答复。我也尝试过使用RegexMatcher,如下所示:
.WithPath("/services/query/")
.WithParam("q", new WireMock.Matchers.RegexMatcher("SELECT Id from User where username.*$"))
Run Code Online (Sandbox Code Playgroud)
但我仍然得到404。
我认为问题出在查询参数中,因为它有两个等于“ =”。有人可以帮我解决这个问题吗?
| 归档时间: |
|
| 查看次数: |
145 次 |
| 最近记录: |