1 var common = require('../common');
2 var assert = require('assert');
3 var http = require('http');
5 // Verify that ServerResponse.getHeader() works correctly even after
6 // the response header has been sent. Issue 752 on github.
8 var s = http.createServer(function(req, res) {
9 var contentType = 'Content-Type';
10 var plain = 'text/plain';
11 res.setHeader(contentType, plain);
12 assert.ok(!res.headersSent);
14 assert.ok(res.headersSent);
15 res.end('hello world\n');
16 // This checks that after the headers have been sent, getHeader works
17 // and does not throw an exception (Issue 752)
20 assert.equal(plain, res.getHeader(contentType));
25 s.listen(common.PORT, runTest);
28 http.get({ port: common.PORT }, function(response) {
29 response.on('end', function() {