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.

Match request body for PUT and POST requests

See original GitHub issue

Hello!

I started to use this library since I switched my work from Angular to React and axios for http-requests. Thank you for this package, that was really a missing feature.

Now I have a lack of matching body for requests with payload. I’d like to do something like this:

mock.onPost('/api/users', {name: 'new user', email: 'test@email.com'}).reply(200);

Then I can to test not only that request was actually called, but also that it has proper body. That feature was built-in in Angular’s mock library, so it would be nice to have it there as well.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wirmarcommented, Jul 19, 2016

I can try and write a PR for this if wanted. @ctimmerm are you okay with having a dependency for a deep equal library like https://github.com/chaijs/deep-eql to implement this Feature or is there an easier way?

0reactions
snowffercommented, Jan 24, 2018

@ludovicthomas Still doesn’t work for me. Return 404.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Are PUT and POST requests required/expected to have a ...
Both POST and PUT include the phrase entity enclosed in the request. Based on my reading, I believe that a body is desired...
Read more >
Request Matching - WireMock
Request body ; Multipart/form-data. Here's an example showing all attributes being matched using WireMock's in-built match operators. It is also possible to ...
Read more >
The best way to add a Request Body to a POST request using ...
It's in different ways and one is unanimous: the use of either String or HashMap in the requests. The intention here is to...
Read more >
HTTP Request Methods – Get vs Put vs Post Explained with ...
We use POST to create a new resource. A POST request requires a body in which you define the data of the entity...
Read more >
Matching POST request BODY - Just getting started - Postman
I am using mock-server to test post and get requests. I have created various examples for a get request that match with the...
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