Created
June 28, 2012 00:25
-
-
Save trentm/3007823 to your computer and use it in GitHub Desktop.
onResponse is gone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: /Users/trentm/tm/npm/lib/utils/fetch.js | |
index f69975b..2962cf9 100644 | |
--- a/lib/utils/fetch.js | |
+++ b/lib/utils/fetch.js | |
@@ -55,14 +55,16 @@ function makeRequest (remote, fstr, headers) { | |
? "https-proxy" | |
: "proxy") | |
- request({ url: remote | |
+ var req = request({ url: remote | |
, proxy: proxy | |
, strictSSL: npm.config.get("strict-ssl") | |
, ca: remote.host === regHost ? npm.config.get("ca") : undefined | |
- , headers: { "user-agent": npm.config.get("user-agent") } | |
- , onResponse: onResponse }).pipe(fstr) | |
- function onResponse (er, res) { | |
- if (er) return fstr.emit("error", er) | |
+ , headers: { "user-agent": npm.config.get("user-agent") }}) | |
+ req.on('error', function (er) { | |
+ fstr.emit("error", er) | |
+ }) | |
+ req.on('response', function (res) { | |
log.http(res.statusCode, remote.href) | |
- } | |
+ }) | |
+ req.pipe(fstr) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment