Hi Everyone, I’m trying to record some Stubs, but ...
# help
c
Hi Everyone, I’m trying to record some Stubs, but I would like that the Stubs created ignore the Body of my requests. Is that Possible? I see a lot of options i requestBodyPattern, but I don’t see any “ignore”. Could you help me please? Thanks a lot!
o
Hi! Have you tried passing an empty
bodyPatterns
list?
c
Hi, That is the first thing I tried 🙂 But it didn’t work, apparentely
{ “targetBaseUrl” : “https://xxxx.dc02.rc.xxxx.de”, “requestBodyPattern” : {} }
This was it
o
There is also
requestBodyPatterns
that seems to work if you pass an empty array. I need to check it locally though
c
I used “requestBodyPatterns”. Is there then a
bodyPatterns
too?
No,
bodyPatterns
is not accepted as parameter in the body 😞
o
Looking
It is weird that the format is not unified across matchers
c
Yeah ☹️
o
According to the documentation, the REST API is expected to take requests without patterns at all.
Copy code
POST /__admin/recordings/start
{
  "targetBaseUrl": "<http://example.mocklab.io>"
}
c
Yes, but then it creates a Stub that need an exact Body to be send
o
Looking into the code
c
Cool , thanks a lot!
Maybe I could use regex to tell that the stub can take any body that I send?
o
Maybe. No test coverage, still need to lurk in the browser. My IDE indexing for Gradle seems to be broken 🤦
c
oh man 😞
o
At least I fixed my Ruby environment when hacking the website. Back to Java...
🙌 1
c
Hi! Were you able to discover if there is any way to tell Wiremock to ignore the body when recording the Stubs? 🙂
o
So, I will submit a small patch. Are you fine with WireMock 3.x?
c
Mmmm, I have no idea. I didn’t set up our WireMock server, I don’t know how can be updated, but I will talk with the person who did it 👍
How will work the patch then? Can be sent a new parameter or something?
o
Yep, a new
acceptAll()
filter
👀 1