Last active
December 18, 2015 19:09
-
-
Save tellnes/5831209 to your computer and use it in GitHub Desktop.
http request .write callback is never called if encoding is specified.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, assert = require('assert') | |
var port = 1337 | |
var callbackCalled = false | |
var server = http.createServer(function (req, res) { | |
req.pipe(res) | |
server.close() | |
}) | |
server.listen(port, function () { | |
var req = http.request({ port: port, method: 'post' }) | |
req.write('test', 'ascii', function () { | |
callbackCalled = true | |
}) | |
}) | |
process.on('exit', function () { | |
assert(callbackCalled, 'calback was never called') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment