mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
HttpRequest增加setFixedContentLength方法
This commit is contained in:
parent
975cfa0fb1
commit
277ecc90dc
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.33(2024-09-13)
|
# 5.8.33(2024-09-14)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 SyncFinisher增加setExecutorService方法(issue#IANKQ1@Gitee)
|
* 【core 】 SyncFinisher增加setExecutorService方法(issue#IANKQ1@Gitee)
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* 【crypto 】 SM2解密时,兼容GmSSL非压缩省略的04头的密文(issue#IAP1QJ@Gitee)
|
* 【crypto 】 SM2解密时,兼容GmSSL非压缩省略的04头的密文(issue#IAP1QJ@Gitee)
|
||||||
* 【core 】 兼容NumberUtil.add方法传入整型自动类型转换为浮点类型的精度丢失问题(pr#3721@Github)
|
* 【core 】 兼容NumberUtil.add方法传入整型自动类型转换为浮点类型的精度丢失问题(pr#3721@Github)
|
||||||
* 【core 】 ModifierUtil明确注释,并增加hasAllModifiers方法(issue#IAQ2U0@Gitee)
|
* 【core 】 ModifierUtil明确注释,并增加hasAllModifiers方法(issue#IAQ2U0@Gitee)
|
||||||
* 【http 】 HttpRequest增加setFixedLengthStreamingMode方法(issue#3462@Github)
|
* 【http 】 HttpRequest增加setFixedContentLength方法(issue#3462@Github)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【json 】 修复JSONConfig.setDateFormat设置后toBean无效问题(issue#3713@Github)
|
* 【json 】 修复JSONConfig.setDateFormat设置后toBean无效问题(issue#3713@Github)
|
||||||
|
@ -238,6 +238,10 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
* 重定向次数计数器,内部使用
|
* 重定向次数计数器,内部使用
|
||||||
*/
|
*/
|
||||||
private int redirectCount;
|
private int redirectCount;
|
||||||
|
/**
|
||||||
|
* 固定长度,用于设置HttpURLConnection.setFixedLengthStreamingMode,默认为0,表示使用默认值,默认值由HttpURLConnection内部决定,通常为0
|
||||||
|
*/
|
||||||
|
private long fixedContentLength;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造,URL编码默认使用UTF-8
|
* 构造,URL编码默认使用UTF-8
|
||||||
@ -358,8 +362,8 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
* @return this
|
* @return this
|
||||||
* @since 5.8.33
|
* @since 5.8.33
|
||||||
*/
|
*/
|
||||||
public HttpRequest setFixedLengthStreamingMode(long contentLength){
|
public HttpRequest setFixedContentLength(long contentLength) {
|
||||||
this.httpConnection.setFixedLengthStreamingMode(contentLength);
|
this.fixedContentLength = contentLength;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,6 +882,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动重定向时是否处理cookie
|
* 自动重定向时是否处理cookie
|
||||||
|
*
|
||||||
* @param followRedirectsCookie 自动重定向时是否处理cookie
|
* @param followRedirectsCookie 自动重定向时是否处理cookie
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
@ -1239,6 +1244,8 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
.setInstanceFollowRedirects(false)
|
.setInstanceFollowRedirects(false)
|
||||||
// 流方式上传数据
|
// 流方式上传数据
|
||||||
.setChunkedStreamingMode(config.blockSize)
|
.setChunkedStreamingMode(config.blockSize)
|
||||||
|
// issue#3462 自定义body长度
|
||||||
|
.setFixedLengthStreamingMode(this.fixedContentLength)
|
||||||
// 覆盖默认Header
|
// 覆盖默认Header
|
||||||
.header(this.headers, false);
|
.header(this.headers, false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user