code-repositories-api-node
Advanced tools
Comparing version 0.1.1 to 0.1.2
26
index.js
@@ -41,10 +41,12 @@ const request = require('request-promise'); | ||
var options = { method, headers, uri }; | ||
if(opts.formData === true) { | ||
options.formData = form; | ||
} | ||
else { | ||
options.form = form; | ||
if(opts.json !== false) { | ||
options.json = true; | ||
if(['PUT', 'POST'].indexOf(method) !== -1) { | ||
if(opts.formData === true) { | ||
options.formData = form; | ||
} | ||
else { | ||
options.form = form; | ||
if(opts.json !== false) { | ||
options.json = true; | ||
} | ||
} | ||
} | ||
@@ -73,2 +75,12 @@ return { uri, headers, options }; | ||
RequestStrategy.prototype.delete = function(form, opts) { | ||
var { uri, headers, options } = this.getOptions('DELETE', form, opts); | ||
console.log(uri); | ||
return request(options) | ||
.catch(err => { | ||
console.log('## Error while DELETEing', (typeof err === 'string' ? err.substr(0, 100): Object.keys(err)), err.statusCode, err.name); | ||
throw err; | ||
}) | ||
}; | ||
RequestStrategy.prototype.setup = function(baseUri, relativePath, headers) { | ||
@@ -75,0 +87,0 @@ // console.log('requestStrategy.setup', baseUri, relativePath, headers); |
{ | ||
"name": "code-repositories-api-node", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Benoît Hubert <benoithubert@gmail.com>", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
3405
92