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

gofer

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gofer - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

### 3.2.0
* Pass meta data into native methods - **[@jkrems](https://github.com/jkrems)** [#62](https://github.com/groupon/gofer/pull/62)
- [`109f6d1`](https://github.com/groupon/gofer/commit/109f6d107585fabbf80205f1a045e8101ed82c32) **feat:** Pass meta data into native methods
- [`44ff043`](https://github.com/groupon/gofer/commit/44ff043fa56b50c4d378eb9c1d404eb5500e8cf8) **refactor:** Remove util dependency
### 3.1.1

@@ -2,0 +9,0 @@

13

lib/errors.js

@@ -34,10 +34,7 @@ /*

var util = require('util');
function StatusCodeError(statusCode, min, max, headers, method, url) {
Error.call(this);
this.message = util.format(
'API Request returned a response outside the status code range (code: %s, range: [%s, %s])',
statusCode, min, max);
this.message = 'API Request returned a response outside the status code range ' +
'(code: ' + statusCode + ', range: [' + min + ', ' + max + '])';
this.headers = headers;

@@ -50,7 +47,9 @@ this.statusCode = statusCode;

}
util.inherits(StatusCodeError, Error);
StatusCodeError.prototype = Object.create(Error.prototype);
StatusCodeError.prototype.constructor = StatusCodeError;
exports.StatusCodeError = StatusCodeError;
function exportError(ctor) {
util.inherits(ctor, StatusCodeError);
ctor.prototype = Object.create(StatusCodeError.prototype);
ctor.prototype.constructor = ctor;
exports[ctor.name] = ctor;

@@ -57,0 +56,0 @@ }

@@ -242,8 +242,14 @@ /*

var method = options.method || 'GET';
var nativeOptions = {
// All official fetch options:
method: options.method || 'GET',
method: method,
headers: filterHeaders(assign(defaultHeaders, options.headers)),
body: body,
redirect: options.redirect,
// Some things we might want to expose for instrumentation to pick up:
serviceName: options.serviceName,
endpointName: options.endpointName,
methodName: options.methodName || method.toLowerCase(),
pathParams: options.pathParams,
};

@@ -261,3 +267,2 @@ var patchedPathname = replacePathParams(urlObj.pathname, options.pathParams);

var nativeUrl = Url.format(patchedUrl);
var request = new Request(nativeUrl, nativeOptions);
var result = new Bluebird(function withResponseTimeout(resolve, reject) {

@@ -275,3 +280,3 @@ function onTimedOut() {

}
Bluebird.resolve(fetch(request))
Bluebird.resolve(fetch(nativeUrl, nativeOptions))
.then(killTimeout)

@@ -278,0 +283,0 @@ .then(partial(verifyAndExtendResponse, nativeUrl, options))

@@ -220,2 +220,3 @@ /*

var method = options.method || 'GET';
return request({

@@ -227,3 +228,3 @@ agent: agent,

port: urlObj.port,
method: options.method || 'GET',
method: method,
path: replacePathParams(urlObj.pathname, options.pathParams) + generateSearch(urlObj.query, options.qs),

@@ -238,2 +239,7 @@ headers: filterHeaders(assign(defaultHeaders, options.headers)),

maxStatusCode: defaultStatusCode(options.maxStatusCode, 299),
// Some things we might want to expose for instrumentation to pick up:
serviceName: options.serviceName,
endpointName: options.endpointName,
methodName: options.methodName || method.toLowerCase(),
pathParams: options.pathParams,
});

@@ -240,0 +246,0 @@ }

{
"name": "gofer",
"version": "3.1.1",
"version": "3.2.0",
"description": "A general purpose service client library",

@@ -9,2 +9,3 @@ "license": "BSD-3-Clause",

"./lib/fetch.js": "./lib/fetch.browser.js",
"./test/instrument.js": "./test/instrument.browser.js",
"./test/mock-service.js": "./test/mock-service.browser.js"

@@ -11,0 +12,0 @@ },

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