我有一个带有一些静态内容的Web应用程序。例如,我有一个发布在http://localhost/images/Head.png
的图像。Png的MediaType。 HTTP请求
现在,我正在对此映像执行Http请求。
ResponseEntity<byte[]> entity = new TestRestTemplate().getForEntity("http://localhost/images/Head.png", byte[].class);`
我想知道哪个内容有这个实体。它应该是image/png
,但它不是。我在这里得到一个例外:
assertEquals("Wrong content type:\n" + entity.getHeaders().getContentType(),
MediaType.valueOf("image/png"), entity.getHeaders().getContentType());`
我应该是哪种内容类型?
谢谢。
您的代码是否在公开回购?你能提供一个链接吗? –
你可以看看它[这里](https://github.com/Santi-7/hello/blob/master/src/test/java/es/unizar/webeng/hello/SystemTests.java) –
为什么代码你提到的是评论?另外,哪个是JUnit测试的输出?甚至,为什么不在屏幕上打印内容类型的值。如果您发现解决方案,请亲自回答此问题并将其标记为已关闭! –