1

これはコードです:

var http = require('http')

var options = { 
    hostname: 'localhost',
    method: 'POST',
    port: 8000,
    path: '/'
}

var s = 3;

http.request(options, (res)=>{  
}).end(s+'')


http.createServer((req, res)=>{ 
    res.writeHead(200, {'Content-type': 'text/plain'})
    var a = "";
    req.on('data', (data)=>{        
        a+= data
    })  
    req.on('end', ()=>{
        res.write(a)
        res.end()       
    })  
}).listen(8000)

戻り値 3 が予期されるときに、サーバーが無効な情報をクライアントに返すのはなぜですか?

4

2 に答える 2