main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
476 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | var url = require('url');
|
---|
| 2 |
|
---|
| 3 | var override = require('../utils/override');
|
---|
| 4 |
|
---|
| 5 | function inlineRequestFrom(option) {
|
---|
| 6 | return override(
|
---|
| 7 | /* jshint camelcase: false */
|
---|
| 8 | proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy),
|
---|
| 9 | option || {}
|
---|
| 10 | );
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | function proxyOptionsFrom(httpProxy) {
|
---|
| 14 | return httpProxy
|
---|
| 15 | ? {
|
---|
| 16 | hostname: url.parse(httpProxy).hostname,
|
---|
| 17 | port: parseInt(url.parse(httpProxy).port)
|
---|
| 18 | }
|
---|
| 19 | : {};
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | module.exports = inlineRequestFrom;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.