1

I have a problem with axios. Can I send data in the body of a GET request? I'm working with a clientAxios constant, which has the configuration data.

I realized a GET request like this:

const getOrganizations = async email => {
    try {
      const response = await clientAxios.get('/organizations', email);
      console.log(response);
      dispatch({
        type: GET_ORGANIZATIONS,
        payload: response.data
      })
    } catch (error) {
      console.log(error.response);
    }
  }

But, when I check the backend console, no data was sent in the body request.

  • While I'm not sure it's strictly forbidden by the spec, sending a body with a GET request is very unusual; are you sure you need to? – IMSoP Sep 09 '20 at 16:56
  • It's unconventional to send a body with a GET, it has no semantic meaning (see e.g. https://stackoverflow.com/q/978061/3001761). – jonrsharpe Sep 09 '20 at 16:56

0 Answers0