GHC 2021-04-03

2 comments.

, https://git.io/JYMLs in anncwb/vite-plugin-mock
feat: add rawResponse option to MockMethod
==========================================

With `rawResponse` we can parse arbitrary requests and return arbitrary responses, instead of being limited to application/json. An example has been added to README.

Fixes #16.

, https://git.io/JYPMj in anncwb/vite-plugin-mock
Feature request: support non-JSON requests/responses
====================================================

I'm trying to mock a third-party API that returns base64-encoded binary data as `text/plain`. Unfortunately, at the moment `parseJson`, `application/plain` and `JSON.stringify` are hard-coded so that seems impossible.

https://github.com/anncwb/vite-plugin-mock/blob/798c61ddd81b9af782ca870139b4a2a6938d624a/src/createMockServer.ts#L77-L83

Would you consider adding support for arbitrary requests and responses? I have a patch at https://github.com/zmwangx/vite-plugin-mock/commit/48e9564bc931d4c32312f5a913aa206432a3cc1c adding a `rawResponse` option to `MockMethod` to achieve this. I can send a PR if you're okay with that approach, but as long as this use case is made possible, anything goes for me. Thanks.