Skip to content
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

fix(test): Avoid EPIPE error in "web-ext sign" test #1346

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tests/functional/fake-amo-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ http.createServer(function(req, res) {
const reply = FAKE_REPLIES[replyIndex++];

if (reply) {
res.writeHead(200, {'content-type': 'application/json'});
res.write(JSON.stringify(reply));
res.end();
req.on('data', function() {
// Ignore request body.
});
// Wait for the transfer of the request body to finish before sending a response.
// Otherwise the client could experience an EPIPE error:
// https://github.com/nodejs/node/issues/12339
req.once('end', function() {
res.writeHead(200, {'content-type': 'application/json'});
res.write(JSON.stringify(reply));
res.end();
});
} else {
process.exit(1);
}
Expand Down