@koi-design/callkit 1.0.24-beta.46 → 1.0.24-beta.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4059,16 +4059,18 @@ var WebCall = (() => {
4059
4059
  } else {
4060
4060
  const logsToSend = this.callKit.logger.sendSdkLogData.slice();
4061
4061
  this.callKit.logger.sendSdkLogData = [strLog];
4062
- return this.post({
4063
- // headers: {
4064
- // 'Content-Type': 'application/json'
4065
- // },
4066
- url: "/agent/user/sdkLog",
4067
- method: "post",
4068
- data: {
4069
- content: logsToSend
4062
+ return this.post(
4063
+ {
4064
+ url: "/agent/user/sdkLog",
4065
+ method: "post",
4066
+ data: {
4067
+ content: logsToSend
4068
+ }
4069
+ },
4070
+ {
4071
+ useFormData: true
4070
4072
  }
4071
- });
4073
+ );
4072
4074
  }
4073
4075
  }
4074
4076
  /**
@@ -4084,7 +4086,7 @@ var WebCall = (() => {
4084
4086
  data: params
4085
4087
  });
4086
4088
  }
4087
- async post(config) {
4089
+ async post(config, extra = {}) {
4088
4090
  this.callKit.logger.debug(`Request ${config.url}:`, config.data);
4089
4091
  const { userInfo, host } = this.callKit.config.getConfig();
4090
4092
  const { sessionId } = userInfo;
@@ -4093,7 +4095,16 @@ var WebCall = (() => {
4093
4095
  "Content-Type": "application/x-www-form-urlencoded",
4094
4096
  ...config.headers
4095
4097
  };
4096
- if (config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
4098
+ if (config.headers["Content-Type"] === "application/x-www-form-urlencoded" && extra.useFormData) {
4099
+ const formData = new FormData();
4100
+ const data2 = config.data || {};
4101
+ for (const key in data2) {
4102
+ if (Object.prototype.hasOwnProperty.call(data2, key)) {
4103
+ formData.append(key, data2[key]);
4104
+ }
4105
+ }
4106
+ config.data = formData;
4107
+ } else {
4097
4108
  config.data = new URLSearchParams(config.data).toString();
4098
4109
  }
4099
4110
  if (sessionId) {