Skip to content

Commit

Permalink
Merge branch 'bugfix/HD-3340' into q/1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Oct 18, 2023
2 parents 3fb336d + f9b36ad commit c7742c0
Show file tree
Hide file tree
Showing 5 changed files with 390 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/hdcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function _createRequest(req, log, callback) {
error.code = response.statusCode;
error.isExpected = true;
log.debug('got expected response code:', { statusCode: response.statusCode });
response.resume(); // Drain the response stream
return callback(error);
}
return callback(undefined, response);
Expand Down Expand Up @@ -267,14 +268,16 @@ class HDProxydClient {
put(stream, size, params, reqUids, callback) {
const log = this.createLogger(reqUids);
this._failover('POST', stream, size, '', 0, log, (err, response) => {
if (response) {
response.resume();
}
if (err || !response) {
return callback(err);
}
if (!response.headers['scal-key']) {
return callback(new HDProxydError('no key returned'));
}
const key = response.headers['scal-key'];
response.resume(); // drain the stream
response.on('end', () => {
return callback(undefined, key);
});
Expand Down
Loading

0 comments on commit c7742c0

Please sign in to comment.