From 43006cfb66fcb214281af1dec4f8150d1a6a42fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=BE=89?= Date: Fri, 15 Nov 2019 22:47:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ansen/http/net/HTTPCaller.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/okhttpencapsulation/src/main/java/com/ansen/http/net/HTTPCaller.java b/okhttpencapsulation/src/main/java/com/ansen/http/net/HTTPCaller.java index 431c956..9954193 100644 --- a/okhttpencapsulation/src/main/java/com/ansen/http/net/HTTPCaller.java +++ b/okhttpencapsulation/src/main/java/com/ansen/http/net/HTTPCaller.java @@ -105,6 +105,7 @@ public void get(final Class clazz,final String url,Header[] header,final private Call getBuilder(String url, Header[] header, HttpResponseHandler responseCallback) { url=Util.getMosaicParameter(url,httpConfig.getCommonField());//拼接公共参数 +// Log.i("ansen","访问的url"+url); Request.Builder builder = new Request.Builder(); builder.url(url); builder.get(); @@ -169,6 +170,7 @@ public T postSync(Class clazz, String url, List form,Heade if (checkAgent()) { return null; } +// Log.i("ansen","url:"+url); Request.Builder builder=getRequestBuild(url,form); byte[] bytes = execute(builder,header); try { @@ -213,7 +215,11 @@ private Request.Builder getRequestBuild(String url,List form){ form.addAll(httpConfig.getCommonField());//添加公共字段 FormBody.Builder formBuilder = new FormBody.Builder(); for (NameValuePair item : form) { - formBuilder.add(item.getName(), item.getValue()); + if(TextUtils.isEmpty(item.getValue())){ + printLog("字段:"+item.getName()+"的值为null"); + continue; + } + formBuilder.add(item.getName(),item.getValue()); } RequestBody requestBody = formBuilder.build(); Request.Builder builder = new Request.Builder();