에서 응답을받을 수 postman
있습니다. 하지만 들어갈 수 없습니다 axios
. 응답으로 html 가져 오기. 무엇이 문제일까요?
import axios from 'react-native-axios';
var config = {
headers: {
'Content-Type': 'Application/Json',
'JsonStub-User-Key': '__USER__KEY',
'JsonStub-Project-Key': '__PROJECT__KEY'
}
};
export async function menuListByCategories() {
// simulate an asynchronous operation
const url = "http://jsonstub.com/burgers";
axios.get(url, {config})
.then((response) = > {
console.log(response.data);
})
.
catch ((error) = > {
console.log("axios error:", error);
});
}
업데이트 : 이 코드의 응답을 확인하십시오.
당신은 추가 할 수 data: {}
있는 config
한하지 않도록 Content-Type
Axios의 제거. 아래 질문에 대한 답을 확인하십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다