http.createServer(function (request, response) {
request.on("end", function () {
if(request.method='PUT')
{
buf1='This is PUT';
console.log('received PUT');
}
response.writeHead(200, {
'Content-Type': 'text/plain'
});
response.end('Hello HTTP!'+buf1);
});
GETも実行しようとしても、PUTコマンドが実行されていることがわかります。私が見逃している基本的なものはありますか?必要なのは、プログラムがメソッドに基づいてすべてのヘッダーを読み取る必要があることだけです。