2017-10-13 2 views
0

이 발생했습니다. body과 (과) 인출 요청을하려고합니다. 그러나 오류 메시지는 unexpected EOF입니다. 사실, 요청이 만들어지면 요청이 전송 된 후 백엔드 로그를 통해 볼 수 있지만 요청 직후에는 오류 메시지가 표시됩니다.반응 네이티브 가져 오기 - 요청 본문 - 내 반응 기본 응용 프로그램에서 예기치 않게 EOF

여기 내 fetch 방법입니다.

var Url = "https://----------"; 
     return fetch(Url, { 
      method: "POST", 
      headers: { 
       'Accept': 'application/json', 
       'Content-Type': 'application/json' 
      }, 
      body: JSON.stringify({'number': '11111111-'}) 
     }) 
      .then((response) => response.json()) 
      .then((responseJson) => { 
       console.log("SEND_SMS RESULT: ",responseJson); 
      }) 
      .done(); 

여기는 오류 화면입니다.

enter image description here

답변

1

내가이 줄에 실패 말할 것이다 : response.json() 당신이 당신의 응답이 유효 JSON 있는지 확인 있습니까?

은 우체부와 응답을 테스트 시도하거나 추가 .catch(e => console.log(e)) done();

관련 문제