Another topic. Now wiremock supports `bodyFileName...
# wiremock-java
i
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
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
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
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
Be careful with serde. I don't know all cases, so this may affect existing functionality.
o
Yep
So I guess it is better to avoid last-minute merge