Skip to content

Commit

Permalink
fix: 修复formData数据处理
Browse files Browse the repository at this point in the history
  • Loading branch information
shuxiaokai3 committed Mar 15, 2021
1 parent 6ffe94a commit 0d3d698
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderer/pages/modules/apidoc/mixin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
}
break;
case "file":
result[key] = value;
result[key] = properties[i]._value;
break;
default: //字符串或其他类型类型不做处理
valueTypeIsArray ? result.push(value) : (result[key] = value);
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/store/apidoc/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ const HttpClient = (() => {
break;
case "multipart/form-data":
Object.keys(this.requestBody).forEach((key) => {
formData.append(key, this.requestBody[key]);
console.log(this.requestBody[key], 99)
const arrayBuffer = this.requestBody[key] || new ArrayBuffer();
formData.append(key, Buffer.from(arrayBuffer));
})
console.log(formData)
Object.assign(this.headers, formData.getHeaders())
body = formData;
break;
case "application/x-www-form-urlencode":
Expand Down

0 comments on commit 0d3d698

Please sign in to comment.