需要向"/...“提交POST请求在form- data中包含以下数据: React Native。
firstName: text,
middleName: text,
lastName: text,
email: text,
country: text Alpha-3 country code (e.g. EGY or DEU),
phone: text,
dob: text Date of birth (format YYYY-mm-dd, e.g. 2001-09-25).,
gender: text,发布于 2020-07-28 13:03:49
请使用FormData。
import FormData from 'FormData';
var data = new FormData();
data.append("firstname", "abc");
fetch('YOUR_URL', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'multipart/form-data',
},
body:data,
})
.then((response) => response.json())
.then((responseJson) => {
console.log('response object:',responseJson)
})
.catch((error) => {
console.error(error);
});https://stackoverflow.com/questions/63126721
复制相似问题