Socket
Socket
Sign inDemoInstall

fetch-link

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

6

index.js

@@ -27,4 +27,8 @@ 'use strict';

fetch (url, direction) {
const request = fetch(url, typeof this.fetchOptions === 'function' ? this.fetchOptions(url) : this.fetchOptions)
const fetchOptions = (typeof this.fetchOptions === 'function') ? this.fetchOptions(url) : this.fetchOptions;
const fetchOptionsPromise = (fetchOptions && typeof fetchOptions.then === 'function') ? fetchOptions : Promise.resolve(fetchOptions);
const request = fetchOptionsPromise
.then(options => fetch(url, options))
this.promises[direction === 'next' ? 'push' : 'unshift'](request);

@@ -31,0 +35,0 @@

2

package.json
{
"name": "fetch-link",
"version": "1.1.0",
"version": "1.2.0",
"description": "Fetch related content by following Link headers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -277,2 +277,20 @@ 'use strict';

})
it('has ability to pass in different options per fetch asynchronously', () => {
return fetchLinks.all('http://domain.com?page=1', {
fetch: function (url) {
return Promise.resolve({
method: 'POST',
headers: {
page: url.split('?').pop()
}
})
}
})
.then(res => {
expect(fetchMock.calls('first')[0][1].headers.page).to.equal('page=1');
expect(fetchMock.calls('second')[0][1].headers.page).to.equal('page=2');
expect(fetchMock.calls('third')[0][1].headers.page).to.equal('page=3');
})
})
})

@@ -279,0 +297,0 @@ })

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc