mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复FileUtil.moveContent会删除源目录的问题 修复HttpBase.body导致的空指针问题
This commit is contained in:
@@ -304,7 +304,7 @@ public abstract class HttpBase<T> {
|
||||
* @return byte[]
|
||||
*/
|
||||
public byte[] bodyBytes() {
|
||||
return this.body.readBytes();
|
||||
return this.body == null ? null : this.body.readBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -355,7 +355,7 @@ public abstract class HttpBase<T> {
|
||||
}
|
||||
|
||||
sb.append("Request Body: ").append(StrUtil.CRLF);
|
||||
sb.append(" ").append(StrUtil.str(this.body.readBytes(), this.charset)).append(StrUtil.CRLF);
|
||||
sb.append(" ").append(StrUtil.str(this.bodyBytes(), this.charset)).append(StrUtil.CRLF);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
@@ -241,7 +241,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
|
||||
if (isAsync) {
|
||||
return this.in;
|
||||
}
|
||||
return this.body.getStream();
|
||||
return null == this.body ? null : this.body.getStream();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,7 +253,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
|
||||
@Override
|
||||
public byte[] bodyBytes() {
|
||||
sync();
|
||||
return this.body.readBytes();
|
||||
return super.bodyBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user