@hyperone/cli-core
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -18,13 +18,16 @@ | ||
const update = async (method, uri, json) => http[method](uri, { | ||
json, | ||
headers: await getHeaders(), | ||
const update = async (method, uri, options={}) => http[method](uri, { | ||
...options, | ||
headers: { | ||
...await getHeaders(), | ||
...options.headers || {}, | ||
}, | ||
}); | ||
result.delete = (uri, body) => update('delete', uri, body); | ||
result.patch = (uri, body) => update('patch', uri, body); | ||
result.post = (uri, body) => update('post', uri, body); | ||
result.put = (uri, body) => update('put', uri, body); | ||
result.head = (uri) => update('head', uri); | ||
result.get = (uri) => update('get', uri); | ||
result.delete = (uri, options={}) => update('delete', uri, options); | ||
result.patch = (uri, options={}) => update('patch', uri, options); | ||
result.post = (uri, options={}) => update('post', uri, options); | ||
result.put = (uri, options={}) => update('put', uri, options); | ||
result.head = (uri, options={}) => update('head', uri, options); | ||
result.get = (uri, options={}) => update('get', uri, options); | ||
@@ -31,0 +34,0 @@ result.setHeaders = (h) => { |
@@ -6,2 +6,7 @@ import fetch from 'node-fetch'; | ||
const renderPath = (path, parameters) => path.replace(new RegExp(/{(.+?)}/g), (source, name) => { | ||
if (name in parameters) return encodeURIComponent(parameters[name]); | ||
return source; | ||
}); | ||
export default { | ||
@@ -52,3 +57,4 @@ init: async (options) => { | ||
}, | ||
getUrl: path => `${spec.servers[0].url}${path}`, | ||
renderPath, | ||
getUrl: (path, parameters = {}) => `${spec.servers[0].url}${renderPath(path, parameters)}`, | ||
spec, // TODO: Remove me | ||
@@ -55,0 +61,0 @@ getChild: (prefix) => Object |
{ | ||
"name": "@hyperone/cli-core", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"license": "MIT", | ||
"gitHead": "0e4a91ccb71944831bdce5a123e2c66db02f8d4c" | ||
"gitHead": "ffed02ce77a52b163cab5ce701d538186609d679" | ||
} |
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
25497
640