Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2021-03-22 14:10:39 +08:00
commit 190c4966b2
2 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -75,6 +76,11 @@ public class HarParser extends HarAbstractParser {
if (harRequest.url != null) {
String[] nameArr = harRequest.url.split("/");
reqName = nameArr[nameArr.length - 1];
//然后进行转码解码
try {
reqName = URLDecoder.decode(reqName,"UTF-8");
}catch (Exception e){
}
}
if (harRequest != null) {

View File

@ -29,6 +29,9 @@ import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* Utility class for working with HAR files.
@ -51,4 +54,13 @@ public class HarUtils {
Har har = JSONObject.parseObject(harJson, Har.class);
return har;
}
public static void main(String[] args) throws UnsupportedEncodingException {
// String str = "%E6%B5%8B%AF";
String str = "测试";
str = URLEncoder.encode(str,"UTF-8");
System.out.println(str);
str = URLDecoder.decode(str,"UTF-8");
System.out.println(str);
}
}