~ubuntu-branches/ubuntu/precise/nodejs/precise

« back to all changes in this revision

Viewing changes to test/simple/test-http-304.js

  • Committer: Bazaar Package Importer
  • Author(s): Jérémy Lal
  • Date: 2010-08-20 11:49:04 UTC
  • mfrom: (7.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100820114904-lz22w6fkth7yh179
Tags: 0.2.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require('../common');
 
1
common = require("../common");
 
2
assert = common.assert
2
3
 
3
 
var sys = require('sys'),
4
 
  http = require('http'),
5
 
  childProcess = require('child_process');
 
4
http = require('http');
 
5
childProcess = require('child_process');
6
6
 
7
7
s = http.createServer(function (request, response) {
8
8
  response.writeHead(304);
9
9
  response.end();
10
10
});
11
 
s.listen(PORT);
12
 
sys.puts('Server running at http://127.0.0.1:'+PORT+'/')
13
 
 
14
 
s.addListener('listening', function () {
15
 
 
16
 
  childProcess.exec('curl -i http://127.0.0.1:'+PORT+'/', function (err, stdout, stderr) {
 
11
 
 
12
s.listen(common.PORT, function () {
 
13
  childProcess.exec('curl -i http://127.0.0.1:'+common.PORT+'/', function (err, stdout, stderr) {
17
14
    if (err) throw err;
18
15
    s.close();
19
 
    error('curled response correctly');
20
 
    error(sys.inspect(stdout));
 
16
    common.error('curled response correctly');
 
17
    common.error(common.inspect(stdout));
21
18
  });
22
 
 
23
19
});
24
20
 
 
21
console.log('Server running at http://127.0.0.1:'+common.PORT+'/')