Playframework 播放框架请求为空

Playframework 播放框架请求为空,playframework,Playframework,我是框架新手,我是UISN2.6版示例项目 在test文件夹中,我编写了一个测试方法,如下所示 测试外部Web服务的步骤 这是我看到的输出 [success] Total time: 81 s, completed 10 Dec, 2017 9:47:23 PM [play-java-rest-api-example] $ test [info] Compiling 1 Java source to E:\minetest\play-java-rest-api-example\target\sc

我是框架新手,我是UISN2.6版示例项目 在test文件夹中,我编写了一个测试方法,如下所示

测试外部Web服务的步骤

这是我看到的输出

[success] Total time: 81 s, completed 10 Dec, 2017 9:47:23 PM
[play-java-rest-api-example] $ test
[info] Compiling 1 Java source to E:\minetest\play-java-rest-api-example\target\scala-2.12\test-classes ...
[info] Done compiling.
[info] Test run started
[info] Test it.IntegrationTest.testList started
[info] application - Creating Pool for datasource 'default'
[info] p.a.d.HikariCPConnectionPool - datasource [default] bound to JNDI as DefaultDS
[info] a.e.s.Slf4jLogger - Slf4jLogger started
THE REQIEST IS RequestBody of null
THE RESULT IS 404
[info] application - Shutting down connection pool.
[info] Test run finished: 0 failed, 0 ignored, 1 total, 9.37s
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[success] Total time: 14 s, completed 10 Dec, 2017 9:48:14 PM
有人能告诉我为什么请求是空的吗

我甚至把它做得很简单,但还是一样的错误

@Test
    public void testBadRoute() {
        RequestBuilder request = Helpers.fakeRequest()
                .method(GET)
                .uri("http://techpaisa.com/supres/acc/");
        System.out.println("body"+request.body());
        Result result = route(app, request);
        System.out.println(result.status());
    }

您的请求不是
null
,但正文是:
request.body()
。在
GET
请求的情况下,正文为空是正常的。

您的请求不是
null
,但正文为:
request.body()
。在一个
GET
请求的情况下,有一个空的主体是正常的。

好的,但是为什么会出现404,该网站是,一个进入ACC并检查控制台它是一个有效的Web服务在测试一个外部网站时,你应该使用
WSClient
:看,这里你将请求发送到你自己的play应用程序哦,天哪,这是一个非常混乱的框架,WSClient没有得到编译,我添加了libraryDependencies++=Seq(ws)你重新加载了你的sbt项目吗?好的,但是为什么会有404,这个网站是,一个进入ACC并检查控制台它是一个有效的Web服务。为了测试一个外部网站,你应该使用
WSClient
:看,这里你将请求发送到你自己的play应用程序哦,天哪,这是一个非常混乱的框架,WSClient未被编译,我添加了libraryDependencies++=Seq(ws)您是否重新加载了sbt项目?
@Test
    public void testBadRoute() {
        RequestBuilder request = Helpers.fakeRequest()
                .method(GET)
                .uri("http://techpaisa.com/supres/acc/");
        System.out.println("body"+request.body());
        Result result = route(app, request);
        System.out.println(result.status());
    }