diff --git a/lib/network/probe/ProbeServer.ts b/lib/network/probe/ProbeServer.ts index 32fb14b26..1e7e4b5ab 100644 --- a/lib/network/probe/ProbeServer.ts +++ b/lib/network/probe/ProbeServer.ts @@ -90,12 +90,6 @@ export class ProbeServer extends httpServer { return; } - const probeResponse = this._handlers.get(req.url!)!(res, log); - if (probeResponse !== undefined && probeResponse !== '') { - // Return an internal error with the response - errors.InternalError - .customizeDescription(probeResponse) - .writeResponse(res); - } + this._handlers.get(req.url!)!(res, log); } } diff --git a/package.json b/package.json index 735a9942b..6e014d140 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=16" }, - "version": "7.70.13", + "version": "7.70.14", "description": "Common utilities for the S3 project components", "main": "build/index.js", "repository": { diff --git a/tests/unit/network/probe/ProbeServer.spec.js b/tests/unit/network/probe/ProbeServer.spec.js index 3f0a74625..12d58db65 100644 --- a/tests/unit/network/probe/ProbeServer.spec.js +++ b/tests/unit/network/probe/ProbeServer.spec.js @@ -89,16 +89,34 @@ describe('network.probe.ProbeServer', () => { }); it('500 response on bad probe', done => { - server.addHandler('/check', () => 'check failed'); + const failedMessage = 'failed_message'; + server.addHandler('/check', res => { + res.writeHead(500); + res.end(failedMessage); + }); + makeRequest('GET', '/check', (err, res) => { + assert.ifError(err); + assert.strictEqual(res.statusCode, 500); + res.setEncoding('utf8'); + res.on('data', body => { + assert.strictEqual(body, failedMessage); + done(); + }); + }); + }); + + it('500 response on bad async probe', done => { + const failedMessage = 'failed_message'; + server.addHandler('/check', async res => { + res.writeHead(500); + res.end(failedMessage); + }); makeRequest('GET', '/check', (err, res) => { assert.ifError(err); assert.strictEqual(res.statusCode, 500); res.setEncoding('utf8'); res.on('data', body => { - assert.strictEqual( - body, - '{"errorType":"InternalError","errorMessage":"check failed"}', - ); + assert.strictEqual(body, failedMessage); done(); }); });