Socket
Socket
Sign inDemoInstall

typed-rest-client

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-rest-client - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

4

HttpClient.d.ts

@@ -50,2 +50,6 @@ import url = require("url");

private _httpProxyBypassHosts;
private _certConfig;
private _ca;
private _cert;
private _key;
constructor(userAgent: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);

@@ -52,0 +56,0 @@ options(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse>;

@@ -16,2 +16,3 @@ // Copyright (c) Microsoft. All rights reserved.

const tunnel = require("tunnel");
const fs = require("fs");
http.globalAgent.maxSockets = 100;

@@ -86,2 +87,13 @@ var HttpCodes;

}
this._certConfig = requestOptions.cert;
// cache the cert content into memory, so we don't have to read it from disk every time
if (this._certConfig && this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) {
this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8');
}
if (this._certConfig && this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) {
this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8');
}
if (this._certConfig && this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) {
this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8');
}
}

@@ -241,2 +253,9 @@ }

}
if (usingSsl && this._certConfig) {
if (!info.options.agent) {
info.options.agent = https.globalAgent;
}
let agent = info.options.agent;
agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase });
}
// gives handlers an opportunity to participate

@@ -243,0 +262,0 @@ if (this.handlers) {

@@ -21,2 +21,3 @@ export interface IHeaders {

proxy?: IProxyConfiguration;
cert?: ICertConfiguration;
}

@@ -29,1 +30,7 @@ export interface IProxyConfiguration {

}
export interface ICertConfiguration {
caFile?: string;
certFile?: string;
keyFile?: string;
passphrase?: string;
}

2

package.json
{
"name": "typed-rest-client",
"version": "0.11.0",
"version": "0.12.0",
"description": "Node Rest and Http Clients with typings for use with TypeScript",

@@ -5,0 +5,0 @@ "main": "./RestClient.js",

@@ -32,2 +32,3 @@ # Typed Rest and Http Client with TypeScript Typings

- Proxy support
- Certificate support (Self-signed server and client cert)
- Layered for Rest or Http use

@@ -34,0 +35,0 @@ - Full Samples and Tests included for usage

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