From f58152a24f8645e3216f0dc4e3e80e80c327b0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392129@qq.com> Date: Mon, 24 Dec 2018 15:05:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BB=A3=E7=A0=81=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/core/tool/utils/OKHttpUtil.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/OKHttpUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/OKHttpUtil.java index 42e3706..718899c 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/utils/OKHttpUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/utils/OKHttpUtil.java @@ -52,14 +52,14 @@ public class OKHttpUtil { StringBuffer sb = new StringBuffer(url); if (queries != null && queries.keySet().size() > 0) { sb.append("?clientId=blade"); - queries.forEach((k, v) -> sb.append("&" + k + "=" + v)); + queries.forEach((k, v) -> sb.append("&").append(k).append("=").append(v)); } Request.Builder builder = new Request.Builder(); //添加请求头 if (header != null && header.keySet().size() > 0) { - header.forEach((k, v) -> builder.addHeader(k, v)); + header.forEach(builder::addHeader); } Request request = builder.url(sb.toString()).build(); @@ -89,13 +89,13 @@ public class OKHttpUtil { FormBody.Builder formBuilder = new FormBody.Builder().add("clientId", "blade"); //添加参数 if (params != null && params.keySet().size() > 0) { - params.forEach((k, v) -> formBuilder.add(k, v)); + params.forEach(formBuilder::add); } Request.Builder builder = new Request.Builder(); //添加请求头 if (header != null && header.keySet().size() > 0) { - header.forEach((k, v) -> builder.addHeader(k, v)); + header.forEach(builder::addHeader); } Request request = builder.url(url).post(formBuilder.build()).build(); @@ -157,7 +157,7 @@ public class OKHttpUtil { Request.Builder builder = new Request.Builder(); //添加请求头 if (header != null && header.keySet().size() > 0) { - header.forEach((k, v) -> builder.addHeader(k, v)); + header.forEach(builder::addHeader); } Request request = builder.url(url).post(requestBody).build(); return getBody(request);