mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
Convert change to ConvertUtil
This commit is contained in:
@@ -19,7 +19,7 @@ package org.dromara.hutool.http.client;
|
||||
import org.dromara.hutool.core.array.ArrayUtil;
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.collection.ListUtil;
|
||||
import org.dromara.hutool.core.convert.Convert;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.HttpUtil;
|
||||
@@ -191,7 +191,7 @@ public interface HeaderOperation<T extends HeaderOperation<T>> {
|
||||
* @since 5.7.9
|
||||
*/
|
||||
default long contentLength() {
|
||||
long contentLength = Convert.toLong(header(HeaderName.CONTENT_LENGTH), -1L);
|
||||
long contentLength = ConvertUtil.toLong(header(HeaderName.CONTENT_LENGTH), -1L);
|
||||
if (contentLength > 0 && (isChunked() || StrUtil.isNotBlank(contentEncoding()))) {
|
||||
//按照HTTP协议规范,在 Transfer-Encoding和Content-Encoding设置后 Content-Length 无效。
|
||||
contentLength = -1;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.dromara.hutool.http.client;
|
||||
|
||||
import org.dromara.hutool.core.convert.Convert;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.HttpException;
|
||||
@@ -172,7 +172,7 @@ public interface Response extends Closeable {
|
||||
* @since 5.7.9
|
||||
*/
|
||||
default long contentLength() {
|
||||
long contentLength = Convert.toLong(header(HeaderName.CONTENT_LENGTH), -1L);
|
||||
long contentLength = ConvertUtil.toLong(header(HeaderName.CONTENT_LENGTH), -1L);
|
||||
if (contentLength > 0 && (isChunked() || StrUtil.isNotBlank(contentEncoding()))) {
|
||||
//按照HTTP协议规范,在 Transfer-Encoding和Content-Encoding设置后 Content-Length 无效。
|
||||
contentLength = -1;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package org.dromara.hutool.http.client.body;
|
||||
|
||||
import org.dromara.hutool.core.collection.CollUtil;
|
||||
import org.dromara.hutool.core.convert.Convert;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.io.resource.FileResource;
|
||||
import org.dromara.hutool.core.io.resource.MultiFileResource;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
@@ -120,7 +120,7 @@ public abstract class FormBody<T extends FormBody<T>> implements HttpBody {
|
||||
strValue = ArrayUtil.join(value, ",");
|
||||
} else {
|
||||
// 其他对象一律转换为字符串
|
||||
strValue = Convert.toStr(value, null);
|
||||
strValue = ConvertUtil.toStr(value, null);
|
||||
}
|
||||
|
||||
return putToForm(name, strValue);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.dromara.hutool.http.client.body;
|
||||
|
||||
import org.dromara.hutool.core.convert.Convert;
|
||||
import org.dromara.hutool.core.convert.ConvertUtil;
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.core.io.IoUtil;
|
||||
import org.dromara.hutool.core.io.file.FileUtil;
|
||||
@@ -123,7 +123,7 @@ public class MultipartOutputStream extends OutputStream {
|
||||
appendResource(formFieldName, new InputStreamResource((Reader) value, this.charset));
|
||||
} else {
|
||||
appendResource(formFieldName,
|
||||
new StringResource(Convert.toStr(value), null, this.charset));
|
||||
new StringResource(ConvertUtil.toStr(value), null, this.charset));
|
||||
}
|
||||
|
||||
write(StrUtil.CRLF);
|
||||
|
Reference in New Issue
Block a user