Improve gzip error message
This commit is contained in:
parent
9eeeadbc07
commit
c0ea5be5d3
@ -126,6 +126,7 @@ function handleCopyFrom (logger) {
|
|||||||
})
|
})
|
||||||
.pipe(isGzip ? zlib.createGunzip() : new PassThrough())
|
.pipe(isGzip ? zlib.createGunzip() : new PassThrough())
|
||||||
.on('error', err => {
|
.on('error', err => {
|
||||||
|
err.message = `Error while gunzipping: ${err.message}`
|
||||||
metrics.end(null, err);
|
metrics.end(null, err);
|
||||||
pgstream.emit('error', err);
|
pgstream.emit('error', err);
|
||||||
})
|
})
|
||||||
|
@ -187,7 +187,7 @@ describe('copy-endpoints', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error when gzip headers are not correct', function(done) {
|
it.only('should return an error when gzip headers are not correct', function(done) {
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: "/api/v1/sql/copyfrom?" + querystring.stringify({
|
url: "/api/v1/sql/copyfrom?" + querystring.stringify({
|
||||||
q: "COPY copy_endpoints_test (id, name) FROM STDIN WITH (FORMAT CSV, DELIMITER ',', HEADER true)"
|
q: "COPY copy_endpoints_test (id, name) FROM STDIN WITH (FORMAT CSV, DELIMITER ',', HEADER true)"
|
||||||
@ -203,7 +203,7 @@ describe('copy-endpoints', function() {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error:["incorrect header check"]
|
error:["Error while gunzipping: incorrect header check"]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
|
Loading…
Reference in New Issue
Block a user