| | |
| | | } |
| | | } |
| | | Request request = headerBuilder.url(url).build(); |
| | | Response response = getClient(timeout, timeUnit).newCall(request).execute(); |
| | | OkHttpClient client = getClient(timeout, timeUnit); |
| | | Response response = client.newCall(request).execute(); |
| | | String result = response.isSuccessful() ? response.body().string() : null; |
| | | response.close(); |
| | | try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {} |
| | | try { client.connectionPool().evictAll(); } catch (Exception ignore) {} |
| | | return result; |
| | | } |
| | | |
| | |
| | | request = builder.post(body).build(); |
| | | |
| | | } |
| | | Call call = getClient(timeout, timeUnit).newCall(request); |
| | | OkHttpClient client = getClient(timeout, timeUnit); |
| | | Call call = client.newCall(request); |
| | | Response response = call.execute(); |
| | | String result = response.body().string(); |
| | | response.close(); |
| | | try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {} |
| | | try { client.connectionPool().evictAll(); } catch (Exception ignore) {} |
| | | return result; |
| | | } |
| | | |