Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 689 for isSuccessful (0.22 sec)

  1. mockwebserver/src/test/java/mockwebserver3/MockResponseSniTest.kt

        val url = server.url("/").newBuilder().host("localhost.localdomain").build()
        val call = client.newCall(Request(url = url))
        val response = call.execute()
        assertThat(response.isSuccessful).isTrue()
    
        val recordedRequest = server.takeRequest()
        assertThat(recordedRequest.handshakeServerNames).containsExactly(url.host)
      }
    
      /**
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.9K bytes
    - Viewed (1)
  2. samples/guide/src/main/java/okhttp3/recipes/kt/CacheResponse.kt

        val request =
          Request.Builder()
            .url("http://publicobject.com/helloworld.txt")
            .build()
    
        val response1Body =
          client.newCall(request).execute().use {
            if (!it.isSuccessful) throw IOException("Unexpected code $it")
    
            println("Response 1 response:          $it")
            println("Response 1 cache response:    ${it.cacheResponse}")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2K bytes
    - Viewed (2)
  3. samples/guide/src/main/java/okhttp3/recipes/CacheResponse.java

            .url("http://publicobject.com/helloworld.txt")
            .build();
    
        String response1Body;
        try (Response response1 = client.newCall(request).execute()) {
          if (!response1.isSuccessful()) throw new IOException("Unexpected code " + response1);
    
          response1Body = response1.body().string();
          System.out.println("Response 1 response:          " + response1);
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 2.4K bytes
    - Viewed (0)
  4. docs/recipes.md

            val request = Request.Builder()
                .url("https://publicobject.com/helloworld.txt")
                .build()
    
            client.newCall(request).execute().use { response ->
              if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
              for ((name, value) in response.headers) {
                println("$name: $value")
              }
    
              println(response.body!!.string())
            }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Feb 18 08:52:22 GMT 2022
    - 40.2K bytes
    - Viewed (1)
  5. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

            .url("https://api.github.com/markdown/raw")
            .post(RequestBody.create(file, 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());
        }
      }
    
      public static void main(String... args) throws Exception {
        new PostFile().run();
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/Authenticate.kt

      fun run() {
        val request =
          Request.Builder()
            .url("http://publicobject.com/secrets/hellosecret.txt")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
          println(response.body.string())
        }
      }
    }
    
    fun main() {
      Authenticate().run()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

            .url("https://api.github.com/markdown/raw")
            .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());
        }
      }
    
      public static void main(String... args) throws Exception {
        new PostStreaming().run();
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/kt/SynchronousGet.kt

      fun run() {
        val request =
          Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
          for ((name, value) in response.headers) {
            println("$name: $value")
          }
    
          println(response.body.string())
        }
      }
    }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/CertificatePinning.java

        Request request = new Request.Builder()
            .url("https://publicobject.com/robots.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          for (Certificate certificate : response.handshake().peerCertificates()) {
            System.out.println(CertificatePinner.pin(certificate));
          }
        }
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Dec 08 21:30:01 GMT 2019
    - 1.7K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/RecordedResponse.kt

        }
    
      fun assertSuccessful() =
        apply {
          assertThat(failure).isNull()
          assertThat(response!!.isSuccessful).isTrue()
        }
    
      fun assertNotSuccessful() =
        apply {
          assertThat(response!!.isSuccessful).isFalse()
        }
    
      fun assertHeader(
        name: String,
        vararg values: String?,
      ) = apply {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.3K bytes
    - Viewed (0)
Back to top