首页 > http的Connect请求会返回什么?

http的Connect请求会返回什么?

具体请先看我的这一段代码

jsvar request=require('supertest');
app.connect('/foo',function(req,res){
    console.log('cao');//not print
    res.send('hello,world');
});
request(app).
    connect('/foo').
    end(function(err,res){
        console.log(res);//undefined
    });

当然我知道这一段代码有问题,我想问的是,到底Connect请求会执行什么操作,会返回什么,如何来测试connect操作!


才发现是 http.connect 啊...=_=! 这个似乎是没有返回的,只是发射一个信号而已(http://nodejs.org/api/http.html#http_event_connect)。你如果要测试是否成功的话就看你后续的操作是否能成功,可以的话就是 OK 的呗(我怎么感觉一般都会成功啊)。

【热门文章】
【热门文章】