Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

client-http

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

client-http - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

test/http-manualProxy.js

3

CHANGELOG.md

@@ -18,1 +18,4 @@ # Changelog

- enhancement: let you read response header in callback
- 0.0.6 (02/04/2014)
- enhancement: Allow set proxy manually by call setProxy

22

lib/clienthttp.js

@@ -9,5 +9,9 @@ 'use strict';

var _cookie = {};
var _proxy;
exports.request = httpRequest;
exports.get = httpGet;
exports.request = httpRequest;
exports.get = httpGet;
exports.setProxy = function(proxy){
_proxy = proxy;
}

@@ -120,3 +124,3 @@ function httpRequest(rawUrl, callback, data, headers){ // data and custom header parameter is optional

}
var proxy = getProxyFromEnv();
var proxy = getProxy();
if (target.protocol==="http:"){

@@ -148,5 +152,11 @@ result.port = target.port ? target.port : 80;

function getProxyFromEnv(){
if (process.env.http_proxy){
var proxy = url.parse(process.env.http_proxy);
function getProxy(){
var proxy;
if (_proxy){
proxy = _proxy;
}else if (process.env.http_proxy){
proxy = process.env.http_proxy;
}
proxy = proxy ? url.parse(proxy) : null;
if (proxy && proxy.host){
return {

@@ -153,0 +163,0 @@ host: proxy.port ? proxy.host.replace(":"+proxy.port, "") : proxy.host,

{
"name": "client-http",
"version": "0.0.5",
"version": "0.0.6",
"description": "Node client HTTP/HTTPS request wrapper for easy to make client HTTP/HTTPS request",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,3 +5,3 @@ # node-client-http: Easy to make client HTTP/HTTPS request

1. Automatic proxy setting, if you set the proxy in your environment variable(http_proxy), it will be auto detected and used in your any HTTP request, also it will be used in your HTTPS request by HTTPS Tunnel(denpency by node-tunnel) to make HTTPS request through HTTP.
1. Automatic proxy setting, if you set the proxy in your environment variable(http_proxy), it will be auto detected and used in your any HTTP request, also it will be used in your HTTPS request by HTTPS Tunnel(denpency by node-tunnel) to make HTTPS request through HTTP. Optional, you can set proxy manually by call setProxy(proxy).

@@ -66,1 +66,10 @@ 2. Make your HTTP/HTTPS request with cookie, cookie will be automatic processed int any HTTP/HTTPS request and you can get the cookie value in response.

}, null, {"User-Agent": "iPhone"});
### HTTP request with manually proxy set
var http = require('client-http');
http.setProxy('http://127.0.0.1:8080');
http.get("https://www.google.com/", function(data){
data && console.log(data);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc