如何在集成测试中包含 http headers (Rails)?

How to include http headers in integration tests (Rails)?

我正在尝试为我的 API 编写集成测试。提出的要求是:

delete sessions_path, session: { article_id: @article.id}

然而,该请求还应包括 http headers:

Authorization: "mytoken"
My_email: @user.email

如何包含这些 http headers?

这个怎么样:

delete sessions_path, {session: { article_id: @article.id}}, {"Authorization" => "mytoken", "My_email" => @user.email}

您可以查看此 answer 了解更多信息。