https://linen.dev logo
#wiremock-java
Title
# wiremock-java
i

Ivan Golovko

08/09/2023, 6:36 PM
Another topic. Now wiremock supports
bodyFileName
feature for response. What about to implement the same for request? Maybe I didn't read the docs well?
o

Oleg Nenashev

08/09/2023, 7:31 PM
I think you read it well. Sourcing of files is not very aligned across the codebase. The reason for introducing this feature was sending big responses for which it makes sense to store them in a separate file. It is hard to imagine the same case for the request matching logic in requests, but in principle it could be sourced from a file too
i

Ivan Golovko

08/10/2023, 6:41 AM
It could be a fat xml for example.
It might look like: 1. We can extend
JsonFilePattern
from
EqualToJsonPattern
.
Copy code
"bodyPatterns": [
  {
    "jsonFileName": "my-dir/qwe.json",
    "ignoreArrayOrder": true,
    ...
  }
]
2. We can let exiting
EqualToJsonPattern
choose its behavior according to declaration.
Copy code
a) "equalToJson": "{}"
b) "equalToJson": "my-dir/qwe.json"
3. We can add a new field into
EqualToJsonPattern
to select the source of
equalToJson
value.
Copy code
"bodyPatterns": [
  {
    "jsonFileName": "my-dir/qwe.json",
    "source": "file/raw(default)",
    ...
  }
]
All of cases requires
FileSource
to be available for
Pattern
or another block of code to modify raw
equalToJson
value in case of file usage. Any other ideas?
@Oleg Nenashev, hi there. Please check out my PR. It's just a prototype with some thoughts. https://github.com/wiremock/wiremock/pull/2330
o

Oleg Nenashev

08/28/2023, 9:59 AM
Thanks! Will review ASAP. Wrapping up the 3.0 release ATM As long as it is not API-breaking one, we can merge it any time
i

Ivan Golovko

08/28/2023, 10:33 AM
Be careful with serde. I don't know all cases, so this may affect existing functionality.
o

Oleg Nenashev

08/28/2023, 1:53 PM
Yep
So I guess it is better to avoid last-minute merge