Typescript 黄瓜炖菜
我对量角器/黄瓜和restler完全陌生。我正在使用打字脚本。下面是我用来点击端点url并获取响应的代码Typescript 黄瓜炖菜,typescript,protractor,cucumber,restler,Typescript,Protractor,Cucumber,Restler,我对量角器/黄瓜和restler完全陌生。我正在使用打字脚本。下面是我用来点击端点url并获取响应的代码 Given('Hit the {string}', async (string) => { browser.quit() var data: any = get(string.replace(/\s+/g, '')); console.log("In method:" + string.replace(/\s+/g, '')); console.log(data.res
Given('Hit the {string}', async (string) => {
browser.quit()
var data: any = get(string.replace(/\s+/g, ''));
console.log("In method:" + string.replace(/\s+/g, ''));
console.log(data.response);
});
这将打印以下内容: 在方法中:端点URL 未定义
我想要打印响应和响应代码 谢谢您的回复。下面的代码有效
Given('Hit the {string}', async (endpointUrl) => {
await get(endpointUrl).on('complete', async (result, response) => {
console.log(response.statusCode);
});
});
我不熟悉restler包,但它可能是一个异步问题。试试这个
console.log(等待数据.response)代码>