Comparing version 0.0.4 to 0.0.5
var AskSteem = require('../index.js') | ||
AskSteem.search({q: 'amy winehouse', include: 'meta'}, function(error, response, request) { | ||
console.log(request.request.uri) | ||
console.log(response.results.length + ' results found') | ||
var query = 'amy winehouse' | ||
AskSteem.search({q: query, include: 'meta'}, function(error, response, request) { | ||
if (error) console.log(error, request) | ||
else console.log(response.results.length+' results for '+query) | ||
}) |
'use strict'; | ||
var request = require('request'); | ||
var fetch = require('fetch'); | ||
@@ -57,3 +57,3 @@ var pathVarsRe = /\${([^\}]+)}/g; | ||
function buildWrapperFn(root, parseResult, method, requestModule, requestOptions, shouldParseJson) { | ||
function buildWrapperFn(root, parseResult, method, fetch, requestOptions, shouldParseJson) { | ||
requestOptions = requestOptions || {}; | ||
@@ -69,6 +69,4 @@ | ||
var uri = buildUri(root, args, parseResult); | ||
var next = shouldParseJson ? getParseJsonFn(cb) : cb; | ||
Object.assign(requestOptions, moreRequestOptions); | ||
requestOptions.uri = uri; | ||
requestOptions.method = method.toUpperCase(); | ||
@@ -78,3 +76,3 @@ requestOptions.body = body; | ||
return requestModule(requestOptions, next); | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
} | ||
@@ -90,7 +88,6 @@ } else { | ||
requestOptions.uri = uri; | ||
requestOptions.method = method.toUpperCase(); | ||
requestOptions.credentials = "omit"; | ||
return requestModule(requestOptions, getParseJsonFn(cb)); | ||
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb)); | ||
} | ||
@@ -138,3 +135,2 @@ } | ||
var requestDefaults = config.requestDefaults; | ||
var requestModule = requestDefaults ? request.defaults(requestDefaults) : request; | ||
var wrapper = {}; | ||
@@ -156,3 +152,3 @@ | ||
parseResult = parse(pathPattern); | ||
wrapper[key] = buildWrapperFn(root, parseResult, method, requestModule, requestOptions, shouldParseJson); | ||
wrapper[key] = buildWrapperFn(root, parseResult, method, fetch, requestOptions, shouldParseJson); | ||
}); | ||
@@ -159,0 +155,0 @@ |
{ | ||
"name": "asksteem", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Wrapper for the AskSteem API", | ||
@@ -16,4 +16,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"request": "^2.83.0" | ||
"fetch": "^1.1.0" | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
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
5181
133
3
+ Addedfetch@^1.1.0
+ Addedbiskviit@1.0.1(transitive)
+ Addedencoding@0.1.12(transitive)
+ Addedfetch@1.1.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
- Removedrequest@^2.83.0
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)