我想打开一个URL并收集其httpcode和错误,但是我无法在goto()。catch中获取其httpcode。
let result = {};
page.goto(url)
.then(res => {
result['http-code'] = res.status();
})
.catch(err => {
result['http-code'] = '?'; // TODO: get http-code in goto().catch
result['page-error'] = err + '';
})
.then(() => {
res.json(result);
});
答案 0 :(得分:0)