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

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 1.0.11 to 1.1.2

1

HttpClient.d.ts

@@ -95,2 +95,3 @@ /// <reference types="node" />

private _prepareRequest(method, requestUrl, headers);
private _mergeHeaders(headers);
private _getAgent(requestUrl);

@@ -97,0 +98,0 @@ private _getProxy(requestUrl);

@@ -280,4 +280,4 @@ "use strict";

info.options.method = method;
info.options.headers = headers || {};
info.options.headers["User-Agent"] = this.userAgent;
info.options.headers = this._mergeHeaders(headers);
info.options.headers["user-agent"] = this.userAgent;
info.options.agent = this._getAgent(requestUrl);

@@ -292,2 +292,9 @@ // gives handlers an opportunity to participate

}
_mergeHeaders(headers) {
const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {});
if (this.requestOptions && this.requestOptions.headers) {
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));
}
return lowercaseKeys(headers || {});
}
_getAgent(requestUrl) {

@@ -294,0 +301,0 @@ let agent;

4

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

@@ -36,2 +36,3 @@ "main": "./RestClient.js",

"mocha": "^3.5.3",
"nock": "9.6.1",
"react-scripts": "1.1.5",

@@ -43,3 +44,2 @@ "shelljs": "0.7.6",

"dependencies": {
"nock": "9.6.1",
"tunnel": "0.0.4",

@@ -46,0 +46,0 @@ "underscore": "1.8.3"

@@ -164,5 +164,6 @@ "use strict";

let obj;
let contents;
// get the result from the body
try {
let contents = yield res.readBody();
contents = yield res.readBody();
if (contents && contents.length > 0) {

@@ -193,2 +194,6 @@ if (options && options.deserializeDates) {

}
else if (contents && contents.length > 0) {
// it may be the case that the exception is in the body message as string
msg = contents;
}
else {

@@ -195,0 +200,0 @@ msg = "Failed request: (" + statusCode + ")";

@@ -14,2 +14,3 @@ "use strict";

function getUrl(resource, baseUrl) {
const pathApi = path.posix || path;
if (!baseUrl) {

@@ -28,3 +29,3 @@ return resource;

resultantUrl.host = resultantUrl.host || base.host;
resultantUrl.pathname = path.posix.resolve(base.pathname, resultantUrl.pathname);
resultantUrl.pathname = pathApi.resolve(base.pathname, resultantUrl.pathname);
if (!resultantUrl.pathname.endsWith('/') && resource.endsWith('/')) {

@@ -31,0 +32,0 @@ resultantUrl.pathname += '/';

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