From ec9eee4aed581f3c6a3d199903d49f07765b87c0 Mon Sep 17 00:00:00 2001 From: Looly Date: Tue, 15 Dec 2020 17:17:54 +0800 Subject: [PATCH] fix comment and add method --- .../src/main/java/cn/hutool/http/HttpRequest.java | 11 +++++++++++ .../main/java/cn/hutool/json/InternalJSONUtil.java | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java b/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java index e52e3fef9..22efdeef7 100644 --- a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java +++ b/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java @@ -1008,6 +1008,17 @@ public class HttpRequest extends HttpBase { return proxyAuth(HttpUtil.buildBasicAuth(username, password, charset)); } + /** + * 令牌验证,生成的头类似于:"Authorization: Bearer XXXXX",一般用于JWT + * + * @param token 令牌内容 + * @return HttpRequest + * @since 5.5.3 + */ + public HttpRequest bearerAuth(String token) { + return auth("Bearer " + token); + } + /** * 验证,简单插入Authorization头 * diff --git a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java b/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java index 177d97b06..95b8099c3 100644 --- a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java +++ b/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java @@ -74,7 +74,7 @@ final class InternalJSONUtil { * 缩进,使用空格符 * * @param writer writer - * @param indent 随进空格数 + * @param indent 缩进空格数 * @throws IOException IO异常 */ protected static void indent(Writer writer, int indent) throws IOException {