Skip to content

Instantly share code, notes, and snippets.

@naholyr
Last active January 4, 2016 16:29
Show Gist options
  • Save naholyr/8647872 to your computer and use it in GitHub Desktop.
Save naholyr/8647872 to your computer and use it in GitHub Desktop.

server

GET /echo HTTP/1.1
lower-case: 1
UPPER-CASE: 2
Mixed-Case: 3
Host: 127.0.0.1:1337
Custom-Header: 4
Connection: keep-alive

test

Headers are sent as-is, keeping case untouched

var http = require('http');
var req = http.request({
hostname: '127.0.0.1',
port: 1337,
method: 'GET',
path: '/echo',
headers: {
'lower-case': 1,
'UPPER-CASE': 2,
'Mixed-Case': 3
}
});
req.setHeader('Custom-Header', 4);
req.write('test');
req.end();
var net = require('net');
var server = net.createServer(function (socket) {
socket.pipe(process.stdout);
});
server.listen(1337, '127.0.0.1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment