- Sort Score
- Result 10 results
- Languages All
Results 91 - 100 of 147 for newCall (0.04 sec)
-
samples/guide/src/main/java/okhttp3/recipes/CheckHandshake.java
.build(); public void run() throws Exception { Request request = new Request.Builder() .url("https://publicobject.com/helloworld.txt") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); System.out.println(response.body().string()); } }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Apr 15 14:55:09 UTC 2024 - 2.1K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/kt/PostStreaming.kt
return n.toString() } } val request = Request( url = "https://api.github.com/markdown/raw".toHttpUrl(), body = requestBody, ) client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") println(response.body.string()) } } companion object {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.9K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/AccessHeaders.java
.addHeader("Accept", "application/json; q=0.5") .addHeader("Accept", "application/vnd.github.v3+json") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); System.out.println("Server: " + response.header("Server"));
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun May 22 01:29:42 UTC 2016 - 1.6K bytes - Viewed (0) -
okhttp/src/main/kotlin/okhttp3/ResponseBody.kt
* [close()][Response.close] for you. * * ```java * Call call = client.newCall(request); * try (Response response = call.execute()) { * ... // Use the response. * } * ``` * * You can use a similar block for asynchronous calls: * * ```java * Call call = client.newCall(request); * call.enqueue(new Callback() {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 10.7K bytes - Viewed (0) -
samples/tlssurvey/src/main/kotlin/okhttp3/survey/Iana.kt
} } suspend fun fetchIanaSuites(okHttpClient: OkHttpClient): IanaSuites { val url = "https://www.iana.org/assignments/tls-parameters/tls-parameters-4.csv" val call = okHttpClient.newCall(Request(url.toHttpUrl())) val suites = call.executeAsync().use { if (!it.isSuccessful) { throw IOException("Failed ${it.code} ${it.message}") } it.body.string().lines()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Thu Apr 18 01:24:38 UTC 2024 - 2K bytes - Viewed (0) -
samples/compare/src/test/kotlin/okhttp3/compare/OkHttpClientTest.kt
val client = OkHttpClient() val request = Request.Builder() .url(server.url("/")) .header("Accept", "text/plain") .build() val response = client.newCall(request).execute() assertThat(response.code).isEqualTo(200) assertThat(response.body.string()).isEqualTo("hello, OkHttp") val recorded = server.takeRequest()
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.8K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/AsynchronousGet.java
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun May 22 01:29:42 UTC 2016 - 1.9K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/ParseResponseWithMoshi.java
public void run() throws Exception { Request request = new Request.Builder() .url("https://api.github.com/gists/c2a7c39532239ff261be") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); Gist gist = gistJsonAdapter.fromJson(response.body().source());
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun May 22 01:29:42 UTC 2016 - 1.8K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/PostMultipart.java
.header("Authorization", "Client-ID " + IMGUR_CLIENT_ID) .url("https://api.imgur.com/3/image") .post(requestBody) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); System.out.println(response.body().string()); } }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jun 24 12:59:42 UTC 2019 - 2.2K bytes - Viewed (0) -
samples/unixdomainsockets/src/main/java/okhttp3/unixdomainsockets/ClientAndServer.java
.build(); Request request = new Request.Builder() .url("http://publicobject.com/helloworld.txt") .build(); try (Response response = client.newCall(request).execute()) { System.out.println(response.body().string()); } server.shutdown(); socketFile.delete(); } public static void main(String... args) throws Exception {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Dec 24 03:46:30 UTC 2018 - 2.1K bytes - Viewed (0)