Browse files

Added proxy support

  • Loading branch information...
1 parent d25d3b7 commit d4894c84a657ddcdd754fe8999e2cfbf09360552 @pksunkara committed Jan 27, 2012
Showing with 12 additions and 7 deletions.
  1. +0 −1 README.md
  2. +12 −6 lib/police/github.js
View
1 README.md
@@ -102,7 +102,6 @@ npm test
Here is a list of [Contributors](http://github.com/pksunkara/npm-police/contributors)
### TODO
-- Proxy support
- Option to isolate dependency checking and suggestions
- Support multiple npm registries (custom)
- Display progress bar instead of listing the dependencies (use charm)
View
18 lib/police/github.js
@@ -211,7 +211,8 @@ github.token = function (auth) {
}),
headers: {
"Content-type": "application/json"
- }
+ },
+ proxy: process.env.https_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==201) {
@@ -244,7 +245,8 @@ github.v2 = function (uri, callback) {
url: github.options.v2.url + uri,
headers: {
"Authorization": "token " + police.config.token(police)
- }
+ },
+ proxy: process.env.http_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==404) {
@@ -265,7 +267,8 @@ github.get = function (uri, callback) {
url: github.options.url + uri,
headers: {
"Authorization": "token " + police.config.token(police)
- }
+ },
+ proxy: process.env.https_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==404) {
@@ -289,7 +292,8 @@ github.post = function (uri, content, callback) {
headers: {
"Content-type": "application/json",
"Authorization": "token " + police.config.token(police)
- }
+ },
+ proxy: process.env.https_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==404) {
@@ -313,7 +317,8 @@ github.put = function (uri, content, callback) {
headers: {
"Content-type": "application/json",
"Authorization": "token " + police.config.token(police)
- }
+ },
+ proxy: process.env.https_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==404) {
@@ -337,7 +342,8 @@ github.del = function (uri, content, callback) {
headers: {
"Content-type": "application/json",
"Authorization": "token " + police.config.token(police)
- }
+ },
+ proxy: process.env.https_proxy
}, function (err, res, body) {
if (err) police.exit(err);
if (res.statusCode==404) {

0 comments on commit d4894c8

Please sign in to comment.