| Aug | SEP | Oct |
| 05 | ||
| 2019 | 2020 | 2021 |
COLLECTED BY
Collection: COVID-19 Outbreak
OkHttpClient client = new OkHttpClient(); String run(String url) throws IOException { Request request = new Request.Builder() .url(url) .build(); try (Response response = client.newCall(request).execute()) { return response.body().string(); } }
public static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); OkHttpClient client = new OkHttpClient(); String post(String url, String json) throws IOException { RequestBody body = RequestBody.create(json, JSON); Request request = new Request.Builder() .url(url) .post(body) .build(); try (Response response = client.newCall(request).execute()) { return response.body().string(); } }Further examples are on the OkHttp Recipes page.
Security.insertProviderAt(Conscrypt.newProvider(), 1);The OkHttp 3.12.x branch supports Android 2.3+ (API level 9+) and Java 7+. These platforms lack support for TLS 1.2 and should not be used. But because upgrading is difficult we will backport critical fixes to the 3.12.x branch through December 31, 2021.
implementation("com.squareup.okhttp3:okhttp:4.8.1")Snapshot builds are available. R8 and ProGuard rules are available.
testImplementation("com.squareup.okhttp3:mockwebserver:4.8.1")
Copyright 2019 Square, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.Calls Copyright © 2019 Square, Inc. powered by MkDocs and Material for MkDocs