mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -1077,7 +1077,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = StrUtil.builder();
|
||||
sb.append("Request Url: ").append(this.url).append(StrUtil.CRLF);
|
||||
sb.append("Request Url: ").append(this.url.setCharset(this.charset)).append(StrUtil.CRLF);
|
||||
sb.append(super.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -1135,7 +1135,9 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
||||
}
|
||||
|
||||
this.httpConnection = HttpConnection
|
||||
.create(this.url.toURL(this.urlHandler), config.proxy)//
|
||||
// issue#I50NHQ
|
||||
// 在生成正式URL前,设置自定义编码
|
||||
.create(this.url.setCharset(this.charset).toURL(this.urlHandler), config.proxy)//
|
||||
.setConnectTimeout(config.connectionTimeout)//
|
||||
.setReadTimeout(config.readTimeout)//
|
||||
.setMethod(this.method)//
|
||||
|
@@ -193,4 +193,19 @@ public class HttpRequestTest {
|
||||
HttpRequest request =HttpUtil.createGet(url).form(map);
|
||||
Console.log(request.execute().body());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void issueI50NHQTest(){
|
||||
String url = "http://127.0.0.1/devicerecord/list";
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("start", "2022-03-31 00:00:00");
|
||||
params.put("end", "2022-03-31 23:59:59");
|
||||
params.put("page", 1);
|
||||
params.put("limit", 10);
|
||||
|
||||
String result = HttpRequest.get(url)
|
||||
.header("token", "123")
|
||||
.form(params).toString();
|
||||
Console.log(result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user