https://linen.dev logo
Title
c

Carlos Roig

04/26/2023, 8:31 AM
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

Oleg Nenashev

04/26/2023, 8:53 AM
Hi! Have you tried passing an empty
bodyPatterns
list?
c

Carlos Roig

04/26/2023, 9:01 AM
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

Oleg Nenashev

04/26/2023, 9:02 AM
There is also
requestBodyPatterns
that seems to work if you pass an empty array. I need to check it locally though
c

Carlos Roig

04/26/2023, 9:03 AM
I used “requestBodyPatterns”. Is there then a
bodyPatterns
too?
No,
bodyPatterns
is not accepted as parameter in the body 😞
o

Oleg Nenashev

04/26/2023, 9:21 AM
Looking
It is weird that the format is not unified across matchers
c

Carlos Roig

04/26/2023, 9:23 AM
Yeah ☹️
o

Oleg Nenashev

04/26/2023, 9:24 AM
According to the documentation, the REST API is expected to take requests without patterns at all.
POST /__admin/recordings/start
{
  "targetBaseUrl": "<http://example.mocklab.io>"
}
c

Carlos Roig

04/26/2023, 9:25 AM
Yes, but then it creates a Stub that need an exact Body to be send
o

Oleg Nenashev

04/26/2023, 9:27 AM
Looking into the code
c

Carlos Roig

04/26/2023, 9:27 AM
Cool , thanks a lot!
Maybe I could use regex to tell that the stub can take any body that I send?
o

Oleg Nenashev

04/26/2023, 11:09 AM
Maybe. No test coverage, still need to lurk in the browser. My IDE indexing for Gradle seems to be broken 🤦
c

Carlos Roig

04/26/2023, 11:33 AM
oh man 😞
o

Oleg Nenashev

04/26/2023, 2:39 PM
At least I fixed my Ruby environment when hacking the website. Back to Java...
🙌 1
c

Carlos Roig

05/03/2023, 6:35 AM
Hi! Were you able to discover if there is any way to tell Wiremock to ignore the body when recording the Stubs? 🙂
o

Oleg Nenashev

05/03/2023, 7:13 AM
So, I will submit a small patch. Are you fine with WireMock 3.x?
c

Carlos Roig

05/03/2023, 7:26 AM
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

Oleg Nenashev

05/03/2023, 7:33 AM
Yep, a new
acceptAll()
filter
👀 1