Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add test case for #4

  • Loading branch information...
commit fa3e2834dc690a5fbaa31d2ff3dfc95f4110e7f8 1 parent 2998f75
@fengmk2 authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 test-old/curl_in_same_process.js
View
30 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);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.