if (newOptions.method = "POST" | | newOptions.method = "PUT") {
if (!(newOptions.body instanceof FormData)) {
newOptions.headers = {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
...newOptions.headers
};
newOptions.body = JSON.stringify(newOptions.body);
} else {
// newOptions.body is FormData
newOptions.headers = {
Accept: "application/json",
...newOptions.headers
};
}
In the code example of }
antd pro, there is a judgment about FormData
this.props.form.validateFields ((err, values) = > {})
values is a json object.
how to become FormData?