You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionlogPOST(){// logPOST is NOT thread safe, e.i. multiple request can write to bodyvarbody=[]returnfunction(request,response){if(request.method==="POST"){console.log("Recieved a POST request. Collecting data...")request.on("data",function(chunk){body.push(chunk)}).on("end",function(){console.log(Buffer.concat(body).toString())body.splice(0,body.length)// empty body array})}}}
Similar to GET request, a POST request could trigger a logger that displays the content of the body in the terminal for quick debugging.
The text was updated successfully, but these errors were encountered: