相关疑难解决方法(0)

发布来自React Native的x-www-form-urlencoded请求

我有一些参数,我想将表格编码POST到我的服务器:

{
    'userName': 'test@gmail.com',
    'password': 'Password!',
    'grant_type': 'password'
}
Run Code Online (Sandbox Code Playgroud)

我正在发送我的请求(目前没有参数)

var obj = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  },
};
fetch('https://example.com/login', obj)
  .then(function(res) {
    // Do stuff with result
  }); 
Run Code Online (Sandbox Code Playgroud)

如何在请求中包含表单编码的参数?

javascript http-post react-native fetch-api

62
推荐指数
9
解决办法
7万
查看次数

标签 统计

fetch-api ×1

http-post ×1

javascript ×1

react-native ×1