Open
Description
For some use cases, we need to able to return image responses as mocks. Like GET.json
or GET.xml
, GET.jpeg
should be returned for an image request. There are some tricky parts for this:
- For response type, we have
auto
type that is checking request content-type header and falls-back to json. But for images we should check mock files for this path in any case for image mock files. - Respect to wildcard support(Fixing wildcard matcher #25), checking all possible mock files will be a bit more complex.
- We should able to extend this approach for other type of responses. (Video, yaml etc.)
So idea is:
- If request is
GET /path
with accept typeapplication/json
we should only checkpath/GET.json
Request method | Request path | Accept type | Mock file to be checked |
---|---|---|---|
GET | /path | application/json | path/GET.json |
GET | /path | application/xml | path/GET.xml |
GET | /path | image/* | path/GET.(jpeg|gif|png...) |
GET | /path | */* | path/GET.(json|xml|jpeg|gif|png...) |
* Custom middlewares should have priority in any case
** If there is no prefered accept type and if there is a json mock file, it should be prioritised