dimanche 27 septembre 2015

MediaType of Png. HTTP request

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

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

ResponseEntity<byte[]> entity = new TestRestTemplate().getForEntity("http://localhost/images/Head.png", byte[].class);`

And I want 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 type should I be?

Thanks.

Aucun commentaire:

Enregistrer un commentaire