小编Haf*_*eem的帖子

在Android中,React-Native Fetch“ POST”请求抛出“ SyntaxError:JSON输入意外结束”

这是我的功能
不知道问题出在哪里

fetchData() {
        fetch(REQUEST_URL, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        Request : 'menu',
        active : '1',
      })
    }).then((response) => response.json())
    .then((responseData) => {
        this.setState({
              menu: responseData.Response,
          }); 
    })
    .catch((error) => {
      console.warn('error',error);
    })
    .done();
      }
Run Code Online (Sandbox Code Playgroud)

请指出功能上的问题

json http-post react-native

3
推荐指数
1
解决办法
7402
查看次数

标签 统计

http-post ×1

json ×1

react-native ×1