fix(core): update

This commit is contained in:
2020-10-09 10:05:26 +00:00
parent 1453abcd5f
commit 9855311739
4 changed files with 48 additions and 17 deletions

View File

@ -21,7 +21,9 @@ export class WebRequest {
const response: Response = await this.request(urlArg, {
method: 'GET'
});
return response.json();
const responseText = await response.text();
const responseResult = plugins.smartjson.parse(responseText);
return responseResult;
}
/**
@ -29,10 +31,12 @@ export class WebRequest {
*/
public async postJson(urlArg: string, requestBody?: any) {
const response: Response = await this.request(urlArg, {
body: JSON.stringify(requestBody),
body: plugins.smartjson.stringify(requestBody),
method: 'POST'
});
return response.json();
const responseText = await response.text();
const responseResult = plugins.smartjson.parse(responseText);
return responseResult;
}
/**
@ -40,10 +44,12 @@ export class WebRequest {
*/
public async putJson(urlArg: string, requestBody?: any) {
const response: Response = await this.request(urlArg, {
body: JSON.stringify(requestBody),
body: plugins.smartjson.stringify(requestBody),
method: 'PUT'
});
return response.json();
const responseText = await response.text();
const responseResult = plugins.smartjson.parse(responseText);
return responseResult;
}
/**
@ -53,7 +59,9 @@ export class WebRequest {
const response: Response = await this.request(urlArg, {
method: 'GET'
});
return response.json();
const responseText = await response.text();
const responseResult = plugins.smartjson.parse(responseText);
return responseResult;
}
/**

View File

@ -1,4 +1,5 @@
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartenv from '@pushrocks/smartenv';
import * as smartjson from '@pushrocks/smartjson';
export { smartdelay, smartenv };
export { smartdelay, smartenv, smartjson };