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 5.2.3 to 5.2.4

7

CHANGELOG.md

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

### v5.2.4 (2022-05-23)
<a id="v5.2.4"></a>
#### 🐛 Bug Fixes
* [#134](https://github.com/groupon/gofer/pull/134) fix: merge URLSearchParams qs arguments ([@dbushong](https://github.com/dbushong))
### v5.2.3 (2022-04-07)

@@ -2,0 +9,0 @@ <a id="v5.2.3"></a>

26

lib/gofer.js

@@ -35,9 +35,9 @@ /*

const fetch = require('./fetch');
const merge = require('lodash.merge');
const mergeWith = require('lodash.mergewith');
const isObjectLike = require('lodash.isobjectlike');
const isPlainObject = require('lodash.isplainobject');
const fetch = require('./fetch');
const { updateSearch } = require('./url');
function Gofer(config, serviceName, clientVersion, clientName) {

@@ -93,4 +93,9 @@ config = config || {};

// just like lodash
function isObjectLike(obj) {
return typeof obj === 'object' && obj != null;
}
const DEFAULT_MERGER = undefined; // (see lodash/mergeWith docs)
function preventComplexMerge(objValue, srcValue) {
function goferMerge(objValue, srcValue) {
if (!isObjectLike(objValue) && !isObjectLike(srcValue)) {

@@ -100,2 +105,11 @@ return DEFAULT_MERGER;

if (
objValue instanceof URLSearchParams ||
srcValue instanceof URLSearchParams
) {
const result = new URLSearchParams(objValue);
updateSearch(result, srcValue);
return result;
}
if (!isPlainObject(objValue) || !isPlainObject(srcValue)) {

@@ -105,3 +119,3 @@ return srcValue || objValue;

return mergeWith({}, objValue, srcValue, preventComplexMerge);
return mergeWith({}, objValue, srcValue, goferMerge);
}

@@ -127,3 +141,3 @@

options,
preventComplexMerge
goferMerge
);

@@ -130,0 +144,0 @@ delete mergedOptions.endpointDefaults;

@@ -42,4 +42,12 @@ /*

if (qs instanceof URLSearchParams) {
/** @type {Set<string>} */
const seenKey = new Set();
for (const [key, val] of qs.entries()) {
query.append(key, val);
// rules for merging keys: all values for a given key in qs should
// replace all values for a given key in query
if (seenKey.has(key)) query.append(key, val);
else {
query.set(key, val);
seenKey.add(key);
}
}

@@ -46,0 +54,0 @@ return query;

{
"name": "gofer",
"version": "5.2.3",
"version": "5.2.4",
"description": "A general purpose service client library",

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

"debug": "^4.3.2",
"lodash.isobjectlike": "^4.0.0",
"lodash.isplainobject": "^4.0.6",

@@ -78,3 +77,3 @@ "lodash.merge": "^4.6.2",

"prettier": "^2.3.2",
"self-signed": "^1.3.1",
"selfsigned": "^2.0.1",
"semver": "^7.3.5"

@@ -81,0 +80,0 @@ },

[![nlm-github](https://img.shields.io/badge/github-groupon%2Fgofer%2Fissues-F4D03F?logo=github&logoColor=white)](https://github.com/groupon/gofer/issues)
![nlm-node](https://img.shields.io/badge/node-%3E%3D10.13-blue?logo=node.js&logoColor=white)
![nlm-version](https://img.shields.io/badge/version-5.2.3-blue?logo=version&logoColor=white)
![nlm-version](https://img.shields.io/badge/version-5.2.4-blue?logo=version&logoColor=white)
[![Build Status](https://travis-ci.com/groupon/gofer.svg?branch=main)](https://travis-ci.com/groupon/gofer)

@@ -5,0 +5,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