带SOQL查询的Wiremock.Net查询参数

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。

我认为问题出在查询参数中,因为它有两个等于“ =”。有人可以帮我解决这个问题吗?

Ste*_*ath 1

此问题已在 WireMock.Net 的最新版本 (1.0.19) 中修复

如果该答案适合您,请重试并将其标记为已接受。

详细信息:解决方案基于从.NET中的字符串获取url参数