HTTP Debugger Console is a small, portable application that allows do debug HTTP traffic from a console application by using JavaScript.
For more samples see scripts/ directory in the downloaded zip file.
httpEngine.addListener('request', function (connection, request) { console.log(connection.url); console.log(connection.application + ' (pid: ' + connection.processId + ')'); console.log(connection.sessionId); return request; }); httpEngine.addListener('response', function (connection, request, response) { console.log(response.status); console.log(connection.sessionId); return response; });
httpEngine.addListener('request', function (connection, request) { console.log('respond to: ' + request.url); var header = 'HTTP/1.1 503 Service Unavailable'; var content = '<html><head><title>503 Service Unavailable</title></head><body><h1>503 Service Unavailable</h1><h2>Reply by HTTP Console</h2></body></html>'; return new httpEngine.httpResponse(header, content); });