dimanche 27 septembre 2015

MediaType of Png. HTTP request

I've a web app with some static content. For example, I've an image /images/Head.png.

Now, I'm doing a Http request to this image.

ResponseEntity<String> entity = new TestRestTemplate().getForEntity("http://localhost:" + + this.port + "/images/Head.png", String.class);

Http request to localhost:8080/images/Head.png

And I wan't to know which content has this entity. It should be image/png, but it isn't.

I get an exception here:

assertEquals("Wrong content type:\n" + entity.getHeaders().getContentType(), MediaType.valueOf("image/png"), entity.getHeaders().getContentType());

Which content shoud I write?

Thanks.




Aucun commentaire:

Enregistrer un commentaire