0

For some reason when sending off requests from an actual android device using React Native as a POST the server only receives GET requests. Can someone explain why this is happening and how to prevent the protocol switching? I read somewhere that specifying the HEADERS will help fix this but not true. Have any others also experienced this anomaly?

addTask = async (title, imgFile) => {

var formData = new FormData();
formData.append("json", JSON.stringify({ title: title, status: "New", priority: "Normal" }));
axios.request({
  url: API_URL + 'tasks',
  method: 'post',
  data: formData,
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  }
}).then(response => {
  console.log('response', response);
});
}
jackfrost
  • 31
  • 2

1 Answers1

0

Apparently for POST requests https is required rather than http... I found the result from StackOverflow - 34570193

I don't recall experiencing any Networking Errors this is why I never looked over this posting in the first place. Hope this helps somebody.

Community
  • 1
  • 1
jackfrost
  • 31
  • 2