Advertisement
Guest User

Untitled

a guest
May 28th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(path=="/string") {
  2.        
  3.            
  4.             if(request.method == 'POST') {
  5.                 console.log("POST");
  6.                 var body = '';
  7.                 request.on('data', function (data) {
  8.                     body += data;
  9.                     console.log(body);
  10.                     if (body.length > 1e6)
  11.                         request.connection.destroy();
  12.  
  13.                 });
  14.  
  15.                 request.on('end', function () {
  16.                    
  17.                     console.log(" " + body);
  18.                    
  19.                 });
  20.  
  21.                 response.writeHead(200, {'Content-Type': 'text/html'});
  22.                 response.end('post received');
  23.             }
  24.        
  25.    
  26.    
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement