Support returning HTTP 404 when mapping files aren't found.
#2.470 geöffnet am 31.10.2023
Repository-Metriken
- Stars
- (5.766 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 1T 15h) (33 gemergte PRs in 30 T)
Beschreibung
Proposal
Right now, WireMock returns an HTTP 500 when it finds a matching response mapping, but that response mapping contains a reference to a file that doesn't exist.
In certain cases, the desired behaviour might be to return an HTTP 404, for example when we create a generic mapping containing a reference to a social security number and we have a set of files containing predefined response bodies for certain SSNs.
To clarify, here's an example JSON response mapping that basically acts as a lookup for a local folder containing response body files:
{
"request": {
"method": "GET",
"urlPathPattern": "/some-endpoint/.*"
},
"response": {
"status": 200,
"bodyFileName": "some-path/{{request.path.[1]}}.json",
"transformers": ["response-template"]
}
}
I'm not proposing that the default behaviour for WireMock should be to return a 404 in all cases where the file isn't found, but there are definitely use cases for it.
References
No response