Closed jarvisaoieong closed 11 years ago
Sometimes production env is different from development env.
In production config
config = { proxy: null };
In development config
config = { proxy: 'http://10.1.10.200:3128' };
It is nice to have this api syntax whatever the value of proxy is null or not.
var config = require('config'); request .get('http://www.google.com') .proxy(config.proxy) .end(function (res) {});
otherwise, i need to write something like this
var config = require('config'); req = request.get('http://www.google.com') if (config.proxy) { req = req.proxy(config.proxy); } req.end(function (res) {});
more ugly
I'm kinda -1 on magical APIs like this. I'm throwing a TypeError on other kinds of invalid input, so we should probably do the same if there's no uri whatsoever.
Sometimes production env is different from development env.
In production config
In development config
It is nice to have this api syntax whatever the value of proxy is null or not.
otherwise, i need to write something like this
more ugly