node-replay
node-replay copied to clipboard
Recording does not work with Wreck
Hi @assaf . Thanks for making this module. This is something I was looking for a long time. But I am trying to use it with wreck npm module (another popular HTTP request module) and the recording does not work. Wondering if you have any ideas? Below is my code:
const Wreck = require('wreck');
const replay = require('replay');
var callback = function(err, response, payload){
console.log(err);
console.log(payload); // converting the buffer to a string and logging
};
Wreck.get('https://www.example.com', callback);
The error is :
bash-3.2$ REPLAY=record node test.js
{ Error: Payload stream closed prematurely
at ProxyResponse.onResClose (/mocks/experiments/wreck_replay/node_modules/wreck/lib/index.js:383:32)
at ProxyResponse.g (events.js:286:16)
at emitNone (events.js:86:13)
at ProxyResponse.emit (events.js:185:7)
at ProxyResponse.<anonymous> (mocks/experiments/wreck_replay/node_modules/replay/lib/replay/proxy.js:163:22)
at ProxyResponse.g (events.js:286:16)