mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-03 20:12:51 +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) {
|
||||
return CapacitorHttp.post({
|
||||
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,
|
||||
}).then((response: HttpResponse) => {
|
||||
return response.data as T;
|
||||
@@ -45,7 +49,11 @@ export class CapacitorRequestor extends Requestor {
|
||||
private async put<T>(url: string, data: any, headers: HttpHeaders) {
|
||||
return CapacitorHttp.put({
|
||||
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,
|
||||
}).then((response: HttpResponse) => response.data as T);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user