fix: pcap webshark upload error 响应错误码
This commit is contained in:
@@ -71,7 +71,7 @@ public class FeignClientConfiguration {
|
||||
log.info("[webSharkClient] [url: {}]", url);
|
||||
return Feign.builder()
|
||||
.encoder(new FormEncoder())
|
||||
//.decoder(new Fastjson2Decoder())
|
||||
.decoder(new Fastjson2Decoder())
|
||||
.client(new Http2Client())
|
||||
.target(WebSharkClient.class, url);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.geedge.asw.module.feign.client;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import feign.Headers;
|
||||
import feign.Param;
|
||||
import feign.RequestLine;
|
||||
@@ -13,5 +14,5 @@ public interface WebSharkClient {
|
||||
|
||||
@RequestLine("POST /webshark/upload")
|
||||
@Headers("Content-Type: multipart/form-data")
|
||||
void upload(@Param("fileKey") File file);
|
||||
JSONObject upload(@Param("fileKey") File file);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.net.url.UrlBuilder;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.log.Log;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -143,7 +144,7 @@ public class PcapController {
|
||||
File newFile = FileUtil.copy(pcapFile, FileUtil.file(Constants.TEMP_PATH, uploadFileName), false);
|
||||
try {
|
||||
WebSharkClient webSharkClient = (WebSharkClient) SpringContextUtils.getBean("webSharkClient");
|
||||
webSharkClient.upload(newFile);
|
||||
JSONObject obj = webSharkClient.upload(newFile);
|
||||
|
||||
String baseUrl = UrlBuilder.ofHttp(websharkurl)
|
||||
.addPath("/webshark")
|
||||
@@ -152,6 +153,7 @@ public class PcapController {
|
||||
result.put("url", baseUrl);
|
||||
}catch (Exception e){
|
||||
log.error(e, "webshark upload pcap error, id: {}", pcap.getId());
|
||||
throw new ASWException(RCode.PCAP_UPLOAD_WEB_SHARK_ERROR);
|
||||
}finally {
|
||||
FileUtil.del(newFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user