New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supertest pipe and end #241
Comments
Confirming that this is a problem. I see no way of uploading a non-multipart application/octet-stream in a PUT or POST request. |
I had a related problem... seems to be possible to upload (at least) using the promise interface. However, the "onend()" of the stream doesn't chain a callback to var csvStream = csv.createWriteStream();
var req = request.post("/sheets/" + sheet3.id + "/load").type("csv");
csvStream.pipe(req);
rows.forEach(function(row) {
csvStream.write(row);
});
return new Promise(function(res) {
csvStream.end(res);
}).then(function() {
return req;
}); Intercepting the call to
resulting in an error when assert tries to chain to the callback. This error also doesn't seem to be caught in the promise chain correctly. |
Turns out writeable streams have a 'finish' event. This is working for me:
|
@dkadrios Any idea how to do this in reverse, eg using |
cannot call
end()
after piping.If you try to
end()
afterpipe()
, writestream prematurely ends & never finishes writing the file (so file is empty) & writestream tries to write again & it throws a 'writing after end' error.the readme says one can use
pipe()
with supertest. What was the test case used to determine that?The text was updated successfully, but these errors were encountered: