question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible using post method with query parameters request matching?

See original GitHub issue
var name = "myGroup";
mockServer
    .Given(Request.Create()
        .WithPath("/api/v4/groups")
        .WithHeader("PRIVATE-TOKEN", token)
        .WithParam("name", name)
        .UsingPost())
    .RespondWith(Response.Create()
        .WithHeader("Content-Type", "application/json")
        .WithStatusCode(HttpStatusCode.Created)
        .WithBody(json));

I’m implementing create group for gitlab server [doc] and trying write tests to verify some cases. Above simple code that doesn’t work when using WithParam as request matching . So… Any way to verify post with query parameters?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
StefHcommented, Mar 22, 2020

What you can do to debug, is set AllowPartialMapping to true in the WireMockServerSettings
https://github.com/WireMock-Net/WireMock.Net/wiki/Settings#allowpartialmapping

When you look at the logging from the running application, you can see which elements have a score from 1.0 (=100% match) image

(I just added a netcore3.1 example to this repository, that one also does work fine.)

1reaction
StefHcommented, Mar 23, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP POST with URL query parameters -- good idea or not?
A web form can't be used to send a request to a page that uses a mix of GET and POST. If you...
Read more >
REST API Design Best Practices for Parameter and Query ...
There are many ways in HTTP to add parameters to our request: the query string, the body of POST, PUT and PATCH requests,...
Read more >
Matching and filtering HTTP requests in WireMock
Stub matching and verification queries can use the following request attributes: URL; HTTP Method; Query parameters; Headers; Basic authentication (a ...
Read more >
Request matching - Basics - Mock Service Worker Docs
request handlers allows you to match requests by the following criteria: Request method;; Request URL. Query parameters and hashes are removed from the...
Read more >
Building requests
You can send path and query parameters with your requests using the URL field and the Params tab. ... To send a query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found