new(basic.gblib): PUT keyword.

This commit is contained in:
Rodrigo Rodriguez 2022-08-05 19:19:30 -03:00
parent d3769e5bf3
commit 619e6ab196

View file

@ -1404,15 +1404,14 @@ export class SystemKeywords {
* *
* @example * @example
* *
* user = post "http://server/path", "data" * user = put "http://server/path", "data"
* talk "The updated user area is" + user.area * talk "The updated user area is" + user.area
* *
*/ */
public async putByHttp(url: string, data, headers) { public async putByHttp(url: string, data, headers) {
const options = { const options = {
uri: url, uri: url,
json: true, json: data,
body: data,
headers: headers headers: headers
}; };
@ -1433,14 +1432,14 @@ export class SystemKeywords {
public async postByHttp(url: string, data, headers) { public async postByHttp(url: string, data, headers) {
const options = { const options = {
uri: url, uri: url,
json: true, json: data,
body: data,
headers: headers headers: headers
}; };
let result = await request.post(options); let result = await request.post(options);
GBLog.info(`[POST]: ${url} (${data}): ${result}`); GBLog.info(`[POST]: ${url} (${data}): ${result}`);
return typeof (result) === 'object' ? result : JSON.parse(result);
return result? typeof (result) === 'object' ? result : JSON.parse(result): true;
} }
public async numberOnly(text: string) { public async numberOnly(text: string) {