From 7f3dde392b15253bd3069f61d4ba45049c4e47e4 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sat, 30 Dec 2017 12:17:18 +1300 Subject: [PATCH 1/2] test: a work around for HTTP weirdness --- test/request-api.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/request-api.spec.js b/test/request-api.spec.js index 5edfafba4..191c72e44 100644 --- a/test/request-api.spec.js +++ b/test/request-api.spec.js @@ -24,7 +24,8 @@ describe('\'deal with HTTP weirdness\' tests', () => { }) server.listen(6001, () => { - ipfsAPI('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => { +// ipfsAPI('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => { + ipfsAPI('/ip4/127.0.0.1/tcp/6001').id((err) => { expect(err).to.not.exist() server.close(done) }) From 9b0c05ba615d0746c7b8e8cda6fab8a6ee858e53 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sat, 30 Dec 2017 12:40:37 +1300 Subject: [PATCH 2/2] test: consume the entire request, before responding --- test/request-api.spec.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/request-api.spec.js b/test/request-api.spec.js index 191c72e44..63a2dce24 100644 --- a/test/request-api.spec.js +++ b/test/request-api.spec.js @@ -19,13 +19,16 @@ describe('\'deal with HTTP weirdness\' tests', () => { // go-ipfs always (currently) adds a content-type header, even if no content is present, // the standard behaviour for an http-api is to omit this header if no content is present const server = require('http').createServer((req, res) => { - res.writeHead(200) - res.end() + // Consume the entire request, before responding. + req.on('data', () => {}) + req.on('end', () => { + res.writeHead(200) + res.end() + }) }) server.listen(6001, () => { -// ipfsAPI('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => { - ipfsAPI('/ip4/127.0.0.1/tcp/6001').id((err) => { + ipfsAPI('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json', (err) => { expect(err).to.not.exist() server.close(done) })