首页 > 解决方案 > 表单数据请求头格式错误

问题描述

我有这个 http 获取请求,它将一些数据发送到本地服务器。在开发工具中,我看到: 图像格式错误,服务器无法正确读取。正确的应该是:

全名:乔治
电话:xxxxxx

我做错了什么?

  const form = new FormData();
    form.append("fullname","george");
    form.append("phone","xxxxxx");
    fetch('http://localhost:3000/', {
      method: 'post',
      headers: {'Content-Type':'application/x-www-form-urlencoded'},
      body: form
    }).then((res)=>{

        console.log(res)

    });

标签: reactjshttp

解决方案


推荐阅读