Skip to content

Instantly share code, notes, and snippets.

@geek
Created September 9, 2015 09:33
Show Gist options
  • Save geek/5d6d9161d4fcf0e4c42d to your computer and use it in GitHub Desktop.
Save geek/5d6d9161d4fcf0e4c42d to your computer and use it in GitHub Desktop.
var Http = require('http');
var Fs = require('fs');
var Url = require('url');
var server = Http.createServer(function (req, res) {
res.writeHead(200);
res.end();
});
server.listen(8080);
var uri = Url.parse('http://localhost:8080/');
uri.method = 'post';
var req = Http.request(uri);
var stream = Fs.createReadStream(__dirname + '/images/wreck.png');
stream.pipe(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment