mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
fix(es6): Converstion broke file uploads by adding body: {}
This commit is contained in:
parent
6602087910
commit
1df70e14f1
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue