Hello Team! I would like to get some assistance re...
# help
s
Hello Team! I would like to get some assistance regarding a strange issue with request matching. So, I am trying to match requests with multipart form data. However, wiremock reports "Form data is not present". If I open admin requests API, I clearly see the requests containing the data I am trying to match with. I am running the latest Docker image, 3.10.0. I also checked it on 3.5.2, with the same result. Additionally, what is the weirdest, such requests were matched without issues a couple of days before. Let me know if I should provide more details, please. Thanks!
image.png
It seems wiremock cannot parse the request body, formParams is empty
But the body itself is not
t
GET requests typically don’t have a body and therefore form data. You’d usually need a POST or PUT for this to work properly.
s
Indeed, but it wasn't me, who invented that cursed API, which I have to write tests against 🙂 Thanks for the comment! I realized what the issue was. It seems wiremock cannot parse multipart form data into form parameters. It was the same with POST requests too. What I did was changing the stub matching. Instead of formParamters, I am using multipartPatterns. It is not as nice as it was before, but does its job.
t
Yeah,
formParameters
just just for URL encoded forms.
👍 1
I think this is the first time I’ve heard of a GET endpoint that attempts to accept a multipart form body!
😁 1
s
Now you know, there are crazy API designers out there 🙂 https://developer.searchstax.com/docs/searchstax-serverless-api/8f84fbfd48eef-list-tags
😱 1
t
The doc UI can’t even render the curl command correctly on that one
🤣 1
s
yeah, horrible stuff
t
Well, we try to be non-judgemental here at WireMock 🙂 Guess it’s time to figure out how to support GET with body properly…
s
it is fine, I guess. At least, I managed to do what I wanted. It's just I don't understand why it seemed working before. Nevertheless, all works now. The tests are green
👍 1