File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,21 @@ module.exports = exports = function(request, log) {
66 log = log || exports . log
77
88 var proto
9- if ( request . Request ) {
10- proto = request . Request . prototype
11- } else if ( request . get && request . post ) {
9+
10+ if ( ! request . Request && request . get && request . post ) {
1211 // The object returned by request.defaults() doesn't include the
1312 // Request property, so do this horrible thing to get at it. Per
1413 // Wikipedia, port 4 is unassigned.
15- var req = request ( 'http://localhost:4' ) . on ( 'error' , function ( ) { } )
16- proto = req . constructor . prototype
14+ var Request = request ( 'http://localhost:4' ) . on ( 'error' , function ( ) { } )
15+ request . Request = Object . assign ( { } , Request ) ;
16+ request . Request . prototype = Object . assign ( { } , Request . prototype ) ;
1717 } else {
1818 throw new Error (
19- "Pass the object returned by require('request') to this function." )
19+ "Pass the object returned by require('request').defaults({}) to this function." )
2020 }
2121
22+ proto = request . Request . prototype
23+
2224 if ( ! proto . _initBeforeDebug ) {
2325 proto . _initBeforeDebug = proto . init
2426
You can’t perform that action at this time.
0 commit comments