title: file download via http post is returning the zip file contents
body: <p>I could see many related topics, but I have a specific problem. I am using spring boot controller to download a zip file. I am able to download the file when it is http verb get, but as I have to pass a big json payload I changed to post. Since then instead of downloading it as file it is responding the contents of the file with some ascii characters. Below is the method in controller for downloading the file.</p>
  
  <pre><code>@ApiResponses(value = { @ApiResponse(code = 404, message = "file could not be found"),
          @ApiResponse(code = 200, message = "File was created sucessfully") })
  @PostMapping(path="/download-file/1.0", produces="application/zip")
  public ResponseEntity&lt;InputStreamResource&gt; downloadFile(
          @ApiParam(value = "File creation contents", required = true) @RequestBody InputDetailsVO inputDetailsVO) {
      File file = null;
      InputStreamResource resource = null;
      HttpHeaders headers = new HttpHeaders();
      try {
          //Creating InputStreamResource out of zip file
          resource = new InputStreamResource(new FileInputStream(file));          
          String contentType = "application/zip";
          if (!StringUtils.isEmpty(contentType)) {
             headers.setContentType(MediaType.parseMediaType(contentType));
          }
          headers.add("Content-Disposition","attachment; filename=\""+file.getName()+"\"");
      } catch (Exception e) {
          log.error("Issue with file creation",e);
  
      }
      return ResponseEntity.ok()
              .contentLength(file.length())
              .contentType(MediaType
                            .parseMediaType(MediaType.APPLICATION_OCTET_STREAM_VALUE))
               .headers(headers).body(resource);
  }   
  </code></pre>
  
  <p>Below is the response I am getting instead of file download</p>
  
  <pre><code>    PK;��N &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;employeeDetails&gt;
  &lt;name&gt;Harry&lt;/name&gt;
  &lt;age&gt;30&lt;/30&gt;
  &lt;email&gt;test@test.com&lt;/test&gt;
  &lt;/employeeDetails&gt;PK�qB�@Y;YPK;��N�qB�@Y;Yemployee details.xmlPKL�Y
  </code></pre>