http.Server
のrequest イベント(つまり、 signature を持つ関数) のハンドラーを作成しましfunction (request, response) { ... }
た。これをテストしたいと思います。http.ServerRequest
モックとhttp.ServerResponse
オブジェクトを介してこれを行いたいと思います。これらを作成するにはどうすればよいですか?
明らかな方法はうまくいかないようです:
$ node
> var http = require('http');
> new http.ServerRequest();
TypeError: undefined is not a function
at repl:1:9
...
「実際の」HTTP サーバーとクライアントを介してこれをテストする必要がありますか?