Comparing version 2.2.3-beta1 to 2.2.3-beta2
{ | ||
"name": "c8osdkjs", | ||
"version": "2.2.3-beta1", | ||
"version": "2.2.3-beta2", | ||
"description": "convertigo's MBaaS client API service", | ||
@@ -5,0 +5,0 @@ "main": "bundle/index.umd.js", |
@@ -122,3 +122,3 @@ "use strict"; | ||
var j = _c[_b]; | ||
formdata.append(p, parameters[p][j], parameters[p][j].name); | ||
formdata.append(p, j, j["name"]); | ||
} | ||
@@ -255,5 +255,6 @@ } | ||
var _this = this; | ||
var headersObject = { "Accept": "application/json", "x-convertigo-sdk": this.c8o.sdkVersion }; | ||
var headersObject = { | ||
'Content-Type': 'multipart/form-data', "x-convertigo-sdk": this.c8o.sdkVersion, withCredentials: true | ||
}; | ||
Object.assign(headersObject, this.c8o.headers); | ||
var headers = { headers: headersObject }; | ||
var progress = new c8oProgress_1.C8oProgress(); | ||
@@ -265,11 +266,12 @@ progress.pull = false; | ||
_this.firstCall = false; | ||
_this.c8o.httpPublic.post({ url: url, data: form, withCredentials: true, headers: headers, onUploadProgress: function (event) { | ||
this.handleProgress(event, progress, parameters, c8oResponseListener, varNull); | ||
} }, { | ||
headers: headers, | ||
withCredentials: true, | ||
_this.c8o.httpPublic({ | ||
method: 'post', | ||
url: url, | ||
data: form, | ||
headers: headersObject | ||
}).then(function (response) { | ||
return resolve(response.data); | ||
}).catch(function (error) { | ||
resolve({ error: (new c8oHttpRequestException_1.C8oHttpRequestException(c8oExceptionMessage_1.C8oExceptionMessage.runHttpRequest(), error)), | ||
resolve({ | ||
error: (new c8oHttpRequestException_1.C8oHttpRequestException(c8oExceptionMessage_1.C8oExceptionMessage.runHttpRequest(), error)), | ||
}); | ||
@@ -283,11 +285,12 @@ }); | ||
Promise.all([_this.p1]).then(function () { | ||
_this.c8o.httpPublic.post({ url: url, data: form, withCredentials: true, headers: headers, onUploadProgress: function (event) { | ||
this.handleProgress(event, progress, parameters, c8oResponseListener, varNull); | ||
} }, { | ||
headers: headers, | ||
withCredentials: true, | ||
_this.c8o.httpPublic({ | ||
method: 'post', | ||
url: url, | ||
data: form, | ||
headers: headersObject | ||
}).then(function (response) { | ||
return resolve(response.data); | ||
}).catch(function (error) { | ||
resolve({ error: (new c8oHttpRequestException_1.C8oHttpRequestException(c8oExceptionMessage_1.C8oExceptionMessage.runHttpRequest(), error)), | ||
resolve({ | ||
error: (new c8oHttpRequestException_1.C8oHttpRequestException(c8oExceptionMessage_1.C8oExceptionMessage.runHttpRequest(), error)), | ||
}); | ||
@@ -294,0 +297,0 @@ }); |
@@ -78,3 +78,3 @@ import {C8oHttpInterfaceCore} from "c8osdkjscore/src/c8o/c8oHttpInterfaceCore"; | ||
public transformRequestformdata(parameters: any): FormData { | ||
const formdata: FormData = new FormData(); | ||
const formdata: FormData = new FormData(); | ||
for (const p in parameters) { | ||
@@ -94,3 +94,3 @@ if (parameters[p] instanceof Array) { | ||
for (const j of parameters[p]) { | ||
formdata.append(p, parameters[p][j], parameters[p][j].name); | ||
formdata.append(p, j, j["name"]); | ||
} | ||
@@ -253,7 +253,16 @@ } else { | ||
*/ | ||
/** | ||
* Upload File using an Http client | ||
* @param {string} url | ||
* @param {FormData} form | ||
* @param {Object} parameters | ||
* @param {C8oResponseListener} c8oResponseListener | ||
* @return {Promise<any>} | ||
*/ | ||
public uploadFileHttp(url: string, form: FormData, parameters: any, | ||
c8oResponseListener: C8oResponseListener): Promise<any> { | ||
const headersObject = {"Accept": "application/json", "x-convertigo-sdk": this.c8o.sdkVersion}; | ||
c8oResponseListener: C8oResponseListener): Promise<any> { | ||
const headersObject = { | ||
'Content-Type': 'multipart/form-data', "x-convertigo-sdk": this.c8o.sdkVersion, withCredentials: true | ||
}; | ||
Object.assign(headersObject, this.c8o.headers); | ||
const headers = {headers: headersObject}; | ||
const progress: C8oProgress = new C8oProgress(); | ||
@@ -266,12 +275,14 @@ progress.pull = false; | ||
this.firstCall = false; | ||
this.c8o.httpPublic.post({url, data: form, withCredentials: true, headers, onUploadProgress(event) { | ||
this.handleProgress(event, progress, parameters, c8oResponseListener, varNull); | ||
}}, { | ||
headers, | ||
withCredentials: true, | ||
}).then((response) => | ||
this.c8o.httpPublic( | ||
{ | ||
method: 'post', | ||
url: url, | ||
data: form, | ||
headers: headersObject | ||
} | ||
).then((response) => | ||
resolve(response.data), | ||
).catch((error) => { | ||
resolve({error : (new C8oHttpRequestException(C8oExceptionMessage.runHttpRequest(), error)), | ||
resolve({ | ||
error: (new C8oHttpRequestException(C8oExceptionMessage.runHttpRequest(), error)), | ||
}); | ||
@@ -284,11 +295,14 @@ }); | ||
Promise.all([this.p1]).then(() => { | ||
this.c8o.httpPublic.post({url, data: form, withCredentials: true, headers, onUploadProgress(event) { | ||
this.handleProgress(event, progress, parameters, c8oResponseListener, varNull); | ||
}}, { | ||
headers, | ||
withCredentials: true, | ||
}).then((response) => | ||
this.c8o.httpPublic( | ||
{ | ||
method: 'post', | ||
url: url, | ||
data: form, | ||
headers: headersObject | ||
} | ||
).then((response) => | ||
resolve(response.data), | ||
).catch((error) => { | ||
resolve({error : (new C8oHttpRequestException(C8oExceptionMessage.runHttpRequest(), error)), | ||
resolve({ | ||
error: (new C8oHttpRequestException(C8oExceptionMessage.runHttpRequest(), error)), | ||
}); | ||
@@ -295,0 +309,0 @@ }); |
Sorry, the diff of this file is not supported yet
3
1020
75846