2016-08-13 3 views
4

나는 네이티브 반응으로 가져 오기를 처음이고, this tutorial을 따릅니다.
json 본문을 개인 api 서버로 보내려고합니다. 서버 로그를 검사하여 본문 내용이 비어 있음을 알았습니다. 기본 반응에 헤더 수 shoueld 때문에 여기 네이티브 가져 오기가 본문을 보내지 않음

authenticateLogIn(){ 
    fetch('<URL>', { 
      method: 'POST', 
      header: {'Content-Type': 'application/json', 'Accept': 'application/json'}, 
      body: JSON.stringify({'username': '<username>', 'password':'<password>'}) 
     }) 
     .then((incoming) => incoming.json()) 
     .then((response) => { 
      console.log(response.header); 
      Alert.alert(JSON.stringify(response.body)); 
     }) 
     .done(); 

답변

7

아마 코드? (들과 함께)

+0

아, 그게 항상, 그것은 단지 하나의 헤더가 아니라 S 없이는 생각 – XPLOT1ON

관련 문제