fix(es6): Converstion broke file uploads by adding body: {}

This commit is contained in:
Ben Gotow 2016-05-31 21:11:01 -07:00
parent 6602087910
commit 1df70e14f1

View file

@ -20,8 +20,11 @@ export default class NylasAPIRequest {
this.api = api;
this.options = Object.assign(defaults, options);
if (this.options.method !== 'GET' || this.options.formData) {
this.options.body = this.options.body || {};
const bodyIsRequired = (this.options.method !== 'GET' && !this.options.formData);
if (bodyIsRequired) {
const fallback = this.options.json ? {} : '';
this.options.body = this.options.body || fallback;
}
}