瀏覽代碼

fix bug:使用FileStorageHelper上传文件时上传失败的问题

lijie 3 年之前
父節點
當前提交
01970b08a9

+ 3 - 1
dmp-comp/dmp-file-starter/src/main/java/com/persagy/dmp/file/utils/FileStorageHelper.java

@@ -66,7 +66,9 @@ public class FileStorageHelper {
         if (CollUtil.isEmpty(content) || StrUtil.isBlank(content.get(0).getUploadUrl())){
             throw new BusinessException(ResponseCode.B0300.getCode(),ResponseCode.B0300.getDesc());
         }
-        HttpResponse response = HttpRequest.put(content.get(0).getUploadUrl()).form("file", streamBytes).execute();
+        HttpResponse response = HttpRequest
+                .put(content.get(0).getUploadUrl())
+                .body(streamBytes).execute();
         if (!response.isOk()){
             log.error("上传文件出错:{}",response.body());
             throw new BusinessException(ResponseCode.B0001.getCode(),ResponseCode.B0001.getDesc());