I'm trying to send an mp4 file as a response body in spring-boot. I've tried setting the Content-Type
header to video/mp4
using the following methods:
A RequestMapping annotation parameter:
@RequestMapping(value = "/movie.mp4", method = RequestMethod.GET, produces = "video/mp4")
Manually setting a header value via HttpHeaders
, passed to return ResponseEntity
.
Each time the resulting header is as follows:
Content-Type:video/mp4; charset=UTF-8
How do I get rid of the charset=UTF-8
postfix?
It took some debugging, but I found that HttpEncodingAutoConfiguration
sets spring.http.encoding.force=true
. If you set this to false in your application.properties
, the charset will be omitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With