mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 20:42:52 +00:00
committed by
Rainer Killinger
parent
f7726378f4
commit
0caa69c28c
@@ -34,7 +34,11 @@ export class CapacitorRequestor extends Requestor {
|
|||||||
private async post<T>(url: string, data: any, headers: HttpHeaders) {
|
private async post<T>(url: string, data: any, headers: HttpHeaders) {
|
||||||
return CapacitorHttp.post({
|
return CapacitorHttp.post({
|
||||||
url,
|
url,
|
||||||
data: this.decodeURLSearchParams(data),
|
// Workaround for CapacitorHttp bug (JSONException when "x-www-form-urlencoded" text is provided)
|
||||||
|
data:
|
||||||
|
headers['Content-Type'] === 'application/x-www-form-urlencoded'
|
||||||
|
? this.decodeURLSearchParams(data)
|
||||||
|
: data,
|
||||||
headers,
|
headers,
|
||||||
}).then((response: HttpResponse) => {
|
}).then((response: HttpResponse) => {
|
||||||
return response.data as T;
|
return response.data as T;
|
||||||
@@ -45,7 +49,11 @@ export class CapacitorRequestor extends Requestor {
|
|||||||
private async put<T>(url: string, data: any, headers: HttpHeaders) {
|
private async put<T>(url: string, data: any, headers: HttpHeaders) {
|
||||||
return CapacitorHttp.put({
|
return CapacitorHttp.put({
|
||||||
url,
|
url,
|
||||||
data: this.decodeURLSearchParams(data),
|
// Workaround for CapacitorHttp bug (JSONException when "x-www-form-urlencoded" text is provided)
|
||||||
|
data:
|
||||||
|
headers['Content-Type'] === 'application/x-www-form-urlencoded'
|
||||||
|
? this.decodeURLSearchParams(data)
|
||||||
|
: data,
|
||||||
headers,
|
headers,
|
||||||
}).then((response: HttpResponse) => response.data as T);
|
}).then((response: HttpResponse) => response.data as T);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user