programing

스프링 부팅으로 생성된 Content-Type 헤더에서 charset=utf-8을 제거하는 방법

instargram 2023. 8. 30. 21:11
반응형

스프링 부팅으로 생성된 Content-Type 헤더에서 charset=utf-8을 제거하는 방법

봄부트에서 대응 본체로 mp4 파일을 보내려고 합니다.설정해봤습니다.Content-Type로 향하는.video/mp4다음 방법을 사용합니다.

  1. RequestMapping 주석 매개변수:

    @RequestMapping(value = "/movie.mp4", method = RequestMethod.GET, produces = "video/mp4")
    
  2. 다음을 통해 수동으로 헤더 값 설정HttpHeaders귀로에 오른ResponseEntity.

매번 결과 헤더는 다음과 같습니다.

Content-Type:video/mp4; charset=UTF-8

어떻게 제거합니까?charset=UTF-8사후 수정?

디버깅하는 데 시간이 좀 걸렸지만, 제가 발견한 것을 발견했습니다.HttpEncodingAutoConfiguration놓다spring.http.encoding.force=true에서 이 값을 false로 설정하는 경우application.properties문자 집합이 생략됩니다.

언급URL : https://stackoverflow.com/questions/32586421/how-to-remove-charset-utf-8-in-a-content-type-header-generated-by-spring-boot

반응형