Skip to content

Commit 009e6a6

Browse files
committed
Request now defaults to GET
1 parent 2b8112b commit 009e6a6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ FilePreviews.prototype.retrieve = function(previewId, callback) {
6161

6262
FilePreviews.prototype.request = function(url, options, callback) {
6363
var data;
64+
var _options = options || {};
6465

6566
var onSuccess = function(error, response, body) {
6667
if (!error && response.statusCode >= 200 && response.statusCode <= 299) {
@@ -83,16 +84,16 @@ FilePreviews.prototype.request = function(url, options, callback) {
8384

8485
var requestOptions = {
8586
url: url,
86-
method: options.method,
87+
method: _options.method || 'GET',
8788
json: true,
8889
auth: {
8990
username: this.apiKey,
9091
password: this.apiSecret
9192
}
9293
};
9394

94-
if (options.data) {
95-
requestOptions.body = options.data;
95+
if (_options.data) {
96+
requestOptions.body = _options.data;
9697
}
9798

9899
this.log('API request to: ' + url);

0 commit comments

Comments
 (0)