Add sendFile function (#562)

* sendFile

* Add default value to filename

* eslint

* (╯°□°)╯︵ ┻━┻
This commit is contained in:
Manuel Kraus
2016-08-29 20:01:05 +02:00
committed by Amish Shah
parent df934eccaf
commit d9ae732bfd
10 changed files with 87 additions and 9 deletions

View File

@@ -29,12 +29,14 @@ class APIRequest {
if (this.auth) {
apiRequest.set('authorization', this.getAuth());
}
if (this.file && this.file.file) {
apiRequest.set('Content-Type', 'multipart/form-data');
apiRequest.attach('file', this.file.file, this.file.name);
}
if (this.data) {
apiRequest.send(this.data);
}
if (this.file) {
apiRequest.attach('file', this.file.file, this.file.name);
}
apiRequest.set('User-Agent', this.rest.userAgentManager.userAgent);
return apiRequest;
}