Skip to content

Commit

Permalink
add test case for #4
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jul 24, 2012
1 parent 2998f75 commit fa3e283
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test-old/curl_in_same_process.js
@@ -0,0 +1,30 @@
/*!
* httpsync - test.js
* Copyright(c) 2012 fengmk2 <fengmk2@gmail.com>
* MIT Licensed
*/

"use strict";

/**
* Module dependencies.
*/

var httpsync = require('../');
var http = require('http');

var app = http.createServer(function (req, res) {
console.log(req.url, req.headers);
req.on('end', function () {
res.end('hello world');
});
});

app.listen(0, function () {
var url = 'http://127.0.0.1:' + app.address().port;
console.log('start to request: ' + url);
var req = httpsync.get(url);
var res = req.end();
console.log(res);
process.exit(0);
});

0 comments on commit fa3e283

Please sign in to comment.