|
|
@@ -34,6 +34,9 @@ export const requestEncryptionInterceptor: IRequestInterceptorAxios = async (con
|
|
|
return config;
|
|
|
}
|
|
|
|
|
|
+ // 指定 axios 按二进制处理响应数据
|
|
|
+ config.responseType = 'arraybuffer';
|
|
|
+
|
|
|
// 指定接口数据压缩方式
|
|
|
config.headers = config.headers ?? {};
|
|
|
config.headers['X-NL-Content-Encoding'] = compressMethod;
|
|
|
@@ -49,13 +52,10 @@ export const requestEncryptionInterceptor: IRequestInterceptorAxios = async (con
|
|
|
config.headers['X-Request-Timestamp'] = timestamp;
|
|
|
}
|
|
|
|
|
|
- if (['post', 'put'].includes(config.method?.toLowerCase() || '') && isNil(config.data)) {
|
|
|
+ if (['post', 'put'].includes(config.method?.toLowerCase() || '') && !isNil(config.data)) {
|
|
|
console.log('[requestEncryptionInterceptor] config:', config);
|
|
|
- // 指定后端返回二进制数据
|
|
|
- config.responseType = 'arraybuffer';
|
|
|
|
|
|
// 设置 Content-Type 为 application/octet-stream
|
|
|
- config.headers = config.headers ?? {};
|
|
|
config.headers['Content-Type'] = 'application/octet-stream';
|
|
|
|
|
|
// 加密请求体
|