title: How to upload octet-stream file to spring-mvc application?
body: <p>Usually for file upload I've used multipart/form-data &amp; it worked fine. But now there is a requirement for my server to be able to accept files  application/octet-stream.</p>
  
  <p>On the server side I have:</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(path = "/mock",
          consumes = { MediaType.APPLICATION_OCTET_STREAM_VALUE },
          method = RequestMethod.POST)
  public ResponseEntity handleFileUpload(@RequestParam("file") MultipartFile file) {
      return ResponseEntity.accepted().build();
  }
  </code></pre>
  
  <p>And I'm trying to test it with curl:</p>
  
  <pre><code>curl -v -H "Content-Type:application/octet-stream" \
    --data-binary @/home/user/Desktop/test.txt http://localhost:9090/mock
  </code></pre>
  
  <p>As a result a have:</p>
  
  <pre><code>org.springframework.web.multipart.MultipartException: Current request is not a multipart request
  </code></pre>
  
  <p>I've noticed that "file" part is not specified in my curl command but expected on the server side. It's not clear where to move next &amp; what is broken test command or server or both.</p>