title: Spring Boot REST - Required String parameter is not present
body: <p>I have trouble with sending data to Spring Boot server. I check with Postman, everything is good, but I use axios library of ReactJS, i get error </p>
  
  <pre><code>Required String parameter 'name' is not present.
  </code></pre>
  
  <h1>addProduct funtion</h1>
  
  <pre><code>addProduct = (e) =&gt; {
   e.preventDefault();
      var { productName, productPrice, productStatus } = this.state;
      callApi('product/add', 'POST', {
          name: productName,
          price: productPrice,
          status: productStatus
      }).then(res =&gt; {
          console.log(res);
      });
  }
  </code></pre>
  
  <h1>productController.java</h1>
  
  <pre><code>@RestController
  @RequestMapping(path = "/api/product")
  public class ProductController {
      @Autowired
      private ProductRespository productRespository;
  
      @GetMapping(path = "/all")
      public @ResponseBody Iterable&lt;Product&gt; getAllProduct(){
          return productRespository.findAll();
      }
  
      @PostMapping(path = "/add")
      @ResponseBody
      public String createProduct(@RequestParam String name, @RequestParam Integer price, @RequestParam String status){
          Product product = new Product();
          product.setName(name);
          product.setPrice(price);
          product.setStatus(status);
          productRespository.save(product);
          return "OK";
      }
  }
  </code></pre>
  
  <h1>apiCaller.js</h1>
  
  <pre><code>import axios from 'axios';
  import * as Config from './../constants/Config';
  
  export default function callApi(endpoint, method, body) {
      return axios({
          method: method,
          url: `http://localhost:8000/api/${endpoint}`,
          data: body,
          headers: {
              'Access-Control-Allow-Origin': '*' 
          }
      }).catch(err =&gt; {
          console.log(err);
      });
  }
  </code></pre>
  
  <p>how can I solve?</p>