首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TestCafe -错误[ERR_HTTP_HEADERS_SENT]:无法在将标头发送到客户端之后设置标头

TestCafe -错误[ERR_HTTP_HEADERS_SENT]:无法在将标头发送到客户端之后设置标头
EN

Stack Overflow用户
提问于 2020-05-04 23:31:26
回答 1查看 298关注 0票数 1

开始使用TestCafe在随机位置获取Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

我有一个本地节点模块,它是createTestCafe()应用编程接口上的包装器。模块名为testcafe-runner,安装方式如下:"testcafe-runner": "file:local_modules/testcafe-runner"

我开始收到错误,但出现了以下异常:

代码语言:javascript
复制
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:485:11)
    at RequestPipelineContext.redirect (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe-hammerhead\lib\request-pipeline\context.js:278:9)
    at TestRun.handlePageError (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe\src\test-run\index.js:287:13)
    at SessionController.handlePageError (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe\src\test-run\session-controller.js:43:36)
    at error (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe-hammerhead\lib\request-pipeline\utils.js:81:48)
    at DestinationRequest.<anonymous> (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe-hammerhead\lib\request-pipeline\utils.js:62:9)
    at DestinationRequest.emit (events.js:209:13)
    at DestinationRequest.EventEmitter.emit (domain.js:476:20)
    at DestinationRequest._onError (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe-hammerhead\lib\request-pipeline\destination-request\index.js:171:17)
    at ClientRequest.<anonymous> (C:\MyTests\local_modules\testcafe-runner\node_modules\testcafe-hammerhead\lib\request-pipeline\destination-request\index.js:93:40) {
  domainThrown: true
}
npm ERR! code ELIFECYCLE
npm ERR! errno 7

所有测试javascript文件都位于C:\MyTests文件夹中。

在local_module和项目上都安装了TestCafe1.8.4版本

EN

回答 1

Stack Overflow用户

发布于 2020-05-14 17:06:11

我得到了确切的错误。

代码语言:javascript
复制
testcafe - 1.8.4
OS - Mac Catalina
browser - chrome 81 
Node - 12.16.3

这是在单击logout按钮时发生的。

发生了302次重定向,最终用户被重定向回登录页面。

测试cafe浏览器url显示为failure http://localhost:1337/03WvIUCEQ/about:error

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61595879

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档