@sibipro/ask
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -17,3 +17,3 @@ const fetch = require('node-fetch'); | ||
module.exports = async function ask(url, config) { | ||
module.exports = async function ask(url, config = {}) { | ||
const { responseType, ...init } = { ...defaults, ...encodeBody(config) }; | ||
@@ -20,0 +20,0 @@ const response = await fetch(url, init); |
@@ -67,2 +67,13 @@ const fetch = require('node-fetch'); | ||
test('works without a config object', async () => { | ||
fetch.mockResolvedValue({ | ||
ok: true, | ||
json: jest.fn(() => ['url 1', 'url 2']), // treats response as json by default | ||
}); | ||
const response = await ask('test/fetch/url'); | ||
expect(response).toEqual(['url 1', 'url 2']); | ||
}); | ||
test('response not ok throws error', async () => { | ||
@@ -69,0 +80,0 @@ fetch.mockResolvedValue({ |
{ | ||
"name": "@sibipro/ask", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6885
153