new(basic.gblib): PUT keyword.
This commit is contained in:
parent
d3769e5bf3
commit
619e6ab196
1 changed files with 5 additions and 6 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue