Scala 当使用play-FakeRequest时,指定uri是否更好?

Scala 当使用play-FakeRequest时,指定uri是否更好?,scala,playframework,scalatest,Scala,Playframework,Scalatest,使用FakereRequest测试我的控制器,在什么情况下我应该指定uri 这是我当前的假请求: val request = FakeRequest(POST, "/").withHeaders("Content-type" -> "application/json").withBody(someBody) 您可以使用Play reverse路由器,因此如果更改路由或在application.conf中放置http.context,您将不会遇到问题 这还有一个优点,即您可以在调用控制器时

使用FakereRequest测试我的控制器,在什么情况下我应该指定uri

这是我当前的假请求:

val request = FakeRequest(POST, "/").withHeaders("Content-type" -> "application/json").withBody(someBody)

您可以使用Play reverse路由器,因此如果更改路由或在
application.conf
中放置
http.context
,您将不会遇到问题

这还有一个优点,即您可以在调用控制器时指定查询参数或路径参数

routes.Application.hello("Bob")