Skip to content

Commit b98be84

Browse files
author
James Haley
committed
Merge pull request #3 from mixmaxhq/support-delete
Support DELETE operations
2 parents 7675294 + 9c51b92 commit b98be84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/batchelor.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ var request = require('request'),
100100
// Set Defaults
101101
options.method = options.method || 'GET';
102102
options.requestId = requestId;
103-
if (options.method !== 'GET') {
103+
if (options.method === 'POST') {
104104
// It's not a GET so we need something to push
105105
if (!options.parameters) {
106106
throw new Error('when using POST: options.parameters is required');
@@ -211,7 +211,9 @@ var request = require('request'),
211211
part.data = parser.parseResponse(part.data.toString());
212212

213213
// Parse response JSON
214-
part.data.body = JSON.parse(part.data.body);
214+
if (part.data.body) {
215+
part.data.body = JSON.parse(part.data.body);
216+
}
215217

216218
// Get the response id if exists
217219
var returnedContentId = part.header['content-id'],

0 commit comments

Comments
 (0)