I have a React application where I am changing POST method to GET with the request body as it is. It works fine with POST request however when I change the method to GET, it
This is not axios, the error origniates from the java backend you're talking to. The public field in your request body is missing.
If you just want to send the data as parameters (which would be odd), pass it using params
instead of data
(as shown here: https://github.com/axios/axios#example).
I personally don't think your API should support GET with a request body (talk to the devs and ask for documentation).