http 模块并非只包含了 HTTP 服务端的功能,它同时还提供了客户端的功能。在这
个测试程序中,我们使用 http.request() 这一工厂方法来创建新的 http 请求对
象,并指定了 options 这个参数。我们通过配置 options 的一系列属性,来让 http.
Request 对象按我们的要求运行。
var http = require("http");
var assert = require("assert");
var options = {
host:"127.0.0.1",
port:2000,
path:"/send",
method:"post",
headers: {
'Content-Type':'application/x-www-form-urlencoded'