【问题标题】:Adding headers in a Spray.io Test Spec fails to send the request into the route在 Spray.io 测试规范中添加标头无法将请求发送到路由中
【发布时间】:2016-11-01 20:21:07
【问题描述】:

我正在使用 Spray 1.3.3。我有一个如下所示的规范:

"Add a collection using a PATCH with correct update hash" in {
  Patch("/datastore/collections/FMI", CollectionPatch(addPriceCodes =
    Some(List(PriceCode("AMI", "22", None))))) ~>
    addHeader(hashHeader, updateHash) ~> routes ~> check {
    status should equal(Accepted)
  }
}

这看起来应该在我看过的文档中,并且它可以编译,但是当我运行它时,我得到了 500。如果我在路由中设置断点,我永远不会进入其中(我在其他不添加标题的测试函数中这样做)。在 IntelliJ 中,我收到一条错误消息,指出它无法解析 addHeaderroutes 之间的符号 ~>

添加标头以发送到路由的正确方法是什么?

【问题讨论】:

    标签: scala intellij-idea spray spray-test


    【解决方案1】:

    结果我上面列出的工作正常。我正在进入我的路线并在异常回溯中查看错误的内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-05
      • 2011-10-19
      • 1970-01-01
      相关资源
      最近更新 更多