MCPcopy Index your code
hub / github.com/request/request / wrapRequest

Function wrapRequest

tests/test-httpModule.js:16–33  ·  view source on GitHub ↗
(name, module)

Source from the content-addressed store, hash-verified

14}
15
16function wrapRequest (name, module) {
17 // Just like the http or https module, but note when a request is made.
18 var wrapped = {}
19 Object.keys(module).forEach(function (key) {
20 var value = module[key]
21
22 if (key === 'request') {
23 wrapped[key] = function (/* options, callback */) {
24 fauxRequestsMade[name] += 1
25 return value.apply(this, arguments)
26 }
27 } else {
28 wrapped[key] = value
29 }
30 })
31
32 return wrapped
33}
34
35var fauxHTTP = wrapRequest('http', http)
36var fauxHTTPS = wrapRequest('https', https)

Callers 1

test-httpModule.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…