Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 518 for isSuccessful (0.17 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 May 03 11:42:14 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2K bytes
    - Viewed (2)
  3. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  4. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/CertificatePinning.kt

      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) {
            println(CertificatePinner.pin(certificate))
          }
        }
      }
    }
    
    fun main() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/AsynchronousGet.kt

            ) {
              e.printStackTrace()
            }
    
            override fun onResponse(
              call: Call,
              response: Response,
            ) {
              response.use {
                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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/kt/DevServer.kt

          .build()
    
      fun run() {
        try {
          val request = Request(server.url("/"))
    
          client.newCall(request).execute().use { response ->
            if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
            println(response.request.url)
          }
        } finally {
          server.shutdown()
        }
      }
    }
    
    fun main() {
      DevServer().run()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  8. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/PostStreaming.kt

        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 {
        val MEDIA_TYPE_MARKDOWN = "text/x-markdown; charset=utf-8".toMediaType()
      }
    }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/kt/YubikeyClientAuth.kt

        val request =
          Request.Builder()
            .url("https://prod.idrix.eu/secure/")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
          println(response.body.string())
        }
      }
    }
    
    object ConsoleCallbackHandler : CallbackHandler {
      override fun handle(callbacks: Array<Callback>) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (1)
Back to top