Camouflage is a backend mocking tool for HTTP, gRPC, Websockets and Thrift protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.
Describe the bug
When I make a request to mock file below, I get an error.
Allow json like messages for WebSocket. Now I have to stringify WS json message.
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
at new NodeError (node:internal/errors:371:5)
at Function.from (node:buffer:322:9)
at toBuffer (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/buffer-util.js:97:18)
at Sender.send (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/sender.js:265:17)
at WebSocket.send (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/websocket.js:421:18)
at Timeout._onTimeout (/usr/local/lib/node_modules/camouflage-server/dist/parser/WebsocketParser.js:61:28)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
code: 'ERR_INVALID_ARG_TYPE'
}
**Expected behavior**
Expects above mock file to work as is.
Describe the bug When I make a request to mock file below, I get an error. Allow json like messages for WebSocket. Now I have to stringify WS json message.
To Reproduce Steps to reproduce the behavior:
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object at new NodeError (node:internal/errors:371:5) at Function.from (node:buffer:322:9) at toBuffer (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/buffer-util.js:97:18) at Sender.send (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/sender.js:265:17) at WebSocket.send (/usr/local/lib/node_modules/camouflage-server/node_modules/ws/lib/websocket.js:421:18) at Timeout._onTimeout (/usr/local/lib/node_modules/camouflage-server/dist/parser/WebsocketParser.js:61:28) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7) { code: 'ERR_INVALID_ARG_TYPE' }