mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-05 21:28:00 +08:00
add methods
This commit is contained in:
parent
c851b34e4a
commit
dc3e87f43b
@ -1021,7 +1021,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
* @since 5.7.8
|
* @since 5.7.8
|
||||||
*/
|
*/
|
||||||
public void then(Consumer<HttpResponse> consumer) {
|
public void then(Consumer<HttpResponse> consumer) {
|
||||||
try (HttpResponse response = execute(true)) {
|
try (final HttpResponse response = execute(true)) {
|
||||||
consumer.accept(response);
|
consumer.accept(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1031,9 +1031,10 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
|||||||
* 处理结束后关闭连接
|
* 处理结束后关闭连接
|
||||||
*
|
*
|
||||||
* @param function 响应内容处理函数
|
* @param function 响应内容处理函数
|
||||||
|
* @since 5.8.5
|
||||||
*/
|
*/
|
||||||
public <T> T thenFunction(Function<HttpResponse, T> function) {
|
public <T> T thenFunction(Function<HttpResponse, T> function) {
|
||||||
try (HttpResponse response = execute(true)) {
|
try (final HttpResponse response = execute(true)) {
|
||||||
return function.apply(response);
|
return function.apply(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user