我有一个 React 应用程序,我将 POST 方法更改为 GET 请求正文。它适用于 POST 请求,但是当我将方法更改为 GET 时,它给了我错误-
message: "org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public
我的前端代码-
export const setData = (getData) => dispatch => {
axios({
method: 'GET',
url: 'http://localhost:8080/api',
headers: {
'Content-Type': 'application/json'
},
data: getData
})
.then (response => {
dispatch({
type: API_DATA,
payload: response.data
})
dispatch({
type: SET_SEARCH_LOADER,
payload: false
})
})
.catch(function(error) {
})
}
有人可以让我知道我在这里缺少什么。根据我的理解,http 允许有一个 GET 方法的请求正文。