Any (custom) JSON media type should be allowed though. As a solution, one may either:
Mock the first media type matching /application\/[A-Za-z.-0-1]*\+?json/ in the media type map of the response's body property
Mock all media types matching /application\/[A-Za-z.-0-1]*\+?json/ in the media type map of the response's body property
Would require mock() and example() to return either
a map of media types
default to i.e. application/json or the first media type in the list and providing mockByMediaType() / exampleByMediaType() methods; analogous to mockByCode()
@repocho Could you please take a look and merge if you think is right? We are using the server and it's creating problems with custom media types.
Cheers
Currently mocks are only generated for responses of the media type
application/json
(https://github.com/RePoChO/raml-mocker/blob/master/src/index.js#L156).Any (custom) JSON media type should be allowed though. As a solution, one may either:
/application\/[A-Za-z.-0-1]*\+?json/
in the media type map of the response's body property/application\/[A-Za-z.-0-1]*\+?json/
in the media type map of the response's body propertymock()
andexample()
to return eitherapplication/json
or the first media type in the list and providingmockByMediaType()
/exampleByMediaType()
methods; analogous tomockByCode()
Any inputs? Would be happy to draft a PR :)