Skip to content

Commit

Permalink
http requests are logged
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanls committed Dec 23, 2012
1 parent 750fea9 commit 8e3c961
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions logHttpRequest.js
Expand Up @@ -29,6 +29,7 @@ var logHttpRequest = function logHttpRequest ( workerName, request, body,
workerName : workerName,
host : request.host,
method : request.method,
path : request.path,
url : request.url,
headers : request.headers,
body : body ? body.toString() : ""
Expand Down
14 changes: 12 additions & 2 deletions wrapHttpRequest.js
Expand Up @@ -17,12 +17,22 @@ var wrapHttpRequest = function wrapHttpRequest ( wrapper, protocol ) {

// if we specifically don't want to mock http requests
if ( protocol == 'http' && wrapper.dontMockHttp ) {

logHttpRequest( wrapper.workerName, options, '',
{ outbound : true, protocol : protocol } );

return http.request.apply( http, arguments );
}

} // if ( protocol == 'http' && wrapper.dontMockHttp )

if ( protocol == 'https' && wrapper.dontMockHttps ) {

logHttpRequest( wrapper.workerName, options, '',
{ outbound : true, protocol : protocol } );

return https.request.apply( https, arguments );
}

} // if ( protocol == 'http' && wrapper.dontMockHttps )

// hostname is preferable, so let's make sure we have that
options.hostname = options.hostname || options.host;
Expand Down

0 comments on commit 8e3c961

Please sign in to comment.