title: Spring API request giving "Content type 'application/octet-stream' not supported" error, however request is successful when using Postman
body: <p>I am trying to send an API request through my React frontend to Spring backend. When I send the request I get this error:</p>
  <pre class="lang-html prettyprint-override"><code>Could not resolve parameter [0] in private org.springframework.http.ResponseEntity com.example.bottlecap.controllers.BottlecapController.entryForm(com.example.bottlecap.domian.Bottlecap,org.springframework.web.multipart.MultipartFile): Content type 'application/octet-stream' not supported
  </code></pre>
  
  <p>However, when I set up the request using Postman it goes through fine. I presume there may be an issue with how I am setting up my FormData on the React end. However, I have had little luck figuring it out.</p>
  <p>My API is supposed to recieve an object that holds data about my submission as well as an image that goes with the submission. In my Postman request, I am creating a form data that holds a JSON file that holds all the object data and a random image just for testing. As I said, the requets goes through fine with this. However, in the frontend code, I am parsing through the object data as Json and adding it to a FormData as well as adding the image to the FormData.</p>
  <p>Here is my Spring Controller:</p>
  <pre class="lang-html prettyprint-override"><code>@RequestMapping(path =&quot;/bottlecap/entry&quot;, method = RequestMethod.POST, consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE})
      private ResponseEntity entryForm(@RequestPart(&quot;cap&quot;) Bottlecap cap, @RequestPart(&quot;file&quot;) MultipartFile image){
          System.out.println(cap);
          cap.toString();
          System.out.println(&quot;Test&quot;);
          return ResponseEntity.ok().build();
  
      }
  </code></pre>
  
  <p>Here is my react Frontend form submission handler:</p>
  <pre class="lang-html prettyprint-override"><code>handleSubmit = event =&gt;{
  
          console.log(this.state.page);
          
          console.log(this.state.page);
          event.preventDefault();
          const cap ={
              &quot;name&quot;:this.state.name,
              &quot;brand&quot;:this.state.brand,
              &quot;yearMade&quot;:parseInt(this.state.yearMade),
              &quot;country&quot;: this.state.country,
              &quot;description&quot;:this.state.description,
              &quot;yearFound&quot;:parseInt(this.state.yearFound),
              &quot;isAlcoholic&quot;:&quot;true&quot;
          };
          const stringCap = JSON.stringify({cap});
          console.log(cap);
          var formData = new FormData();
          formData.append('cap', JSON.parse(stringCap));
          formData.append('file',this.state.imageFile)
          
          
              axios.post('http://localhost:8080/bottlecap/entry', formData, {headers:{'Content-Type':'multipart/form-data'}})
              .then(res=&gt;{
                  console.log(res);
                  console.log(res.data);
                  //window.location = &quot;/success&quot;
                  this.setState({pageDone:true})
                  this.setState({pageLoading:true})
              })
  
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Wp5oF.png" rel="nofollow noreferrer">Here is a screenshot of my Postman request if it may help. </a></p>
  <p>Also here is the contents of the json file I am sending through on Postman, if it may help as well.</p>
  <pre class="lang-html prettyprint-override"><code>{&quot;name&quot;:&quot;post-test&quot;,
  &quot;brand&quot;:&quot;post-test&quot;,
  &quot;yearMade&quot;:1000,
  &quot;country&quot;:&quot;post-test&quot;,
  &quot;description&quot;:&quot;post-test&quot;,
  &quot;yearFound&quot;:1000,
  &quot;isAlcoholic&quot;:&quot;true&quot;}
  </code></pre>
  
  <p>The last change I did was adding a header to the axios API request, but still no luck.</p>