'Content type 'application/gzip;charset=UTF-8' not supported

I am trying to support gzip post request in the spring-boot application.

Requirement: client can upload gzip file in the post request and the server will respond as a success and store the file in some location. But I am getting errors as unsupported content-type application/gzip.

Here is the code snippet to

@RestController
@RequestMapping("/post")
public class Post {
  @PostMapping(
  value = "/body",
  consumes = {MediaType.APPLICATION_JSON_VALUE, "application/gzip;charset=UTF-8"},
  produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
  public JSONObject postBody() {
    JSONObject response = new JSONObject();
    response.put("Message", "success");
    return response;
  }
}

Sample post request I want to support Sample post request I want to support enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source