0
React Native를 POST로 사용하여 실제 안드로이드 장치로부터 요청을 보내는 경우 서버는 GET 요청 만받습니다. 왜 이런 일이 일어나고 프로토콜 전환을 막을 수 있는지 설명 할 수 있습니까? HEADERS를 지정하는 것이이 문제를 해결하는데 도움이되지만 사실이 아님을 나는 어딘가에서 읽었다. 다른 사람들도이 변칙을 경험 했습니까? POST 요청은 https를위한 분명히React Native가 POST를 GET 요청으로 변경하지 못하도록합니다.
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);
});
}