- Sort Score
- Result 10 results
- Languages All
Results 61 - 70 of 147 for newCall (0.21 sec)
-
android-test/src/androidTest/java/okhttp/android/test/sni/SniOverrideTest.kt
} .build() val request = Request.Builder() .url("https://sni.cloudflaressl.com/cdn-cgi/trace") .header("Host", "cloudflare-dns.com") .build() client.newCall(request).execute().use { response -> assertThat(response.code).isEqualTo(200) assertThat(response.protocol).isEqualTo(Protocol.HTTP_2) assertThat(response.body.string()).contains("h=cloudflare-dns.com")
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 3.6K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.kt
fun tearDown() { Thread.interrupted() // Clear interrupted state. } @Test fun interruptWritingRequestBody() { server.enqueue(MockResponse()) server.start() val call = client.newCall( Request.Builder() .url(server.url("/")) .post( object : RequestBody() { override fun contentType() = null
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 4.6K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/kt/PostFile.kt
val file = File("README.md") val request = Request( url = "https://api.github.com/markdown/raw".toHttpUrl(), body = file.asRequestBody(MEDIA_TYPE_MARKDOWN), ) 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.4K bytes - Viewed (0) -
docs/features/https.md
.build()) .build() fun run() { val request = Request.Builder() .url("https://publicobject.com/robots.txt") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") for (certificate in response.handshake!!.peerCertificates) {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Dec 24 00:16:30 UTC 2022 - 10.5K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/ConfigureTimeouts.java
public void run() throws Exception { Request request = new Request.Builder() .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay. .build(); try (Response response = client.newCall(request).execute()) { System.out.println("Response completed: " + response); } } public static void main(String... args) throws Exception { new ConfigureTimeouts().run(); }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sat Sep 28 18:00:26 UTC 2019 - 1.5K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/SynchronousGet.java
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); Headers responseHeaders = response.headers(); for (int i = 0; i < responseHeaders.size(); i++) {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun May 22 01:29:42 UTC 2016 - 1.5K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/kt/PostString.kt
| """.trimMargin() val request = Request( url = "https://api.github.com/markdown/raw".toHttpUrl(), body = postBody.toRequestBody(MEDIA_TYPE_MARKDOWN), ) 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.6K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/kt/PostPath.kt
writeUtf8("{}") } val request = Request.Builder() .url("https://httpbin.org/anything") .put(path.asRequestBody(fileSystem, MEDIA_TYPE_JSON)) .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") fileSystem.sink(path).use { response.body.source().readAll(it) }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.6K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/CurrentDateHeader.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()) { System.out.println(response.request().header("Date")); } } static class CurrentDateInterceptor implements Interceptor {
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Wed Oct 31 15:32:50 UTC 2018 - 1.8K bytes - Viewed (0) -
samples/guide/src/main/java/okhttp3/recipes/PostString.java
Request request = new Request.Builder() .url("https://api.github.com/markdown/raw") .post(RequestBody.create(postBody, MEDIA_TYPE_MARKDOWN)) .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: Sat May 25 18:02:55 UTC 2019 - 1.7K bytes - Viewed (0)