Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for responseBody (0.5 sec)

  1. okhttp/src/commonJvmAndroid/kotlin/okhttp3/ResponseBody.kt

     *
     * ```java
     * Call call = client.newCall(request);
     * call.enqueue(new Callback() {
     *   public void onResponse(Call call, Response response) throws IOException {
     *     try (ResponseBody responseBody = response.body()) {
     *     ... // Use the response.
     *     }
     *   }
     *
     *   public void onFailure(Call call, IOException e) {
     *   ... // Handle the failure.
     *   }
     * });
     * ```
     *
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue May 27 14:51:25 UTC 2025
    - 11.6K bytes
    - Viewed (0)
  2. okhttp/src/jvmTest/kotlin/okhttp3/DuplexTest.kt

          val responseBody = response.body.source()
          assertThat(responseBody.readUtf8Line())
            .isEqualTo("response A")
          assertThat(responseBody.readUtf8Line())
            .isEqualTo("response B")
          requestBody.writeUtf8("request C\n")
          requestBody.close()
          assertThat(responseBody.readUtf8Line()).isNull()
        }
        body.awaitSuccess()
      }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Jun 18 12:28:21 UTC 2025
    - 24.8K bytes
    - Viewed (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Response.kt

       * [closed][ResponseBody] and may be consumed only once.
       *
       * If this is a [cacheResponse], [networkResponse], or [priorResponse], the server's response body
       * is not available, and it is always an error to attempt read its streamed content. Reading from
       * [ResponseBody.source] always throws on such instances.
       *
       * It is safe and supported to call [ResponseBody.contentType] and [ResponseBody.contentLength] on
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 28 14:39:28 UTC 2025
    - 18.1K bytes
    - Viewed (0)
  4. okhttp/src/jvmTest/kotlin/okhttp3/KotlinSourceModernTest.kt

        val bytes = responseBody.bytes()
        val charStream = responseBody.charStream()
        val string = responseBody.string()
        responseBody.close()
        responseBody = "".toResponseBody("".toMediaType())
        responseBody = "".toResponseBody(null)
        responseBody = ByteString.EMPTY.toResponseBody("".toMediaType())
        responseBody = ByteString.EMPTY.toResponseBody(null)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jun 21 20:36:35 UTC 2025
    - 46.5K bytes
    - Viewed (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/TrailersTest.kt

      }
    
      private fun peekTrailers(protocol: Protocol) {
        val responseBody = "a".repeat(OKHTTP_CLIENT_WINDOW_SIZE)
        enableProtocol(protocol)
    
        server.enqueue(
          MockResponse
            .Builder()
            .addHeader("h1", "v1")
            .trailers(headersOf("t1", "v2"))
            .body(protocol, responseBody)
            .build(),
        )
    
        val call = client.newCall(Request(server.url("/")))
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 18:57:05 UTC 2025
    - 18K bytes
    - Viewed (0)
  6. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/CancelTest.kt

        val response = call.execute()
        cancelLater(call, 500)
        val responseBody = response.body.byteStream()
        val buffer = ByteArray(1024)
        assertFailsWith<IOException> {
          while (responseBody.read(buffer) != -1) {
          }
        }.also { expected ->
          assertEquals(cancelMode == INTERRUPT, Thread.interrupted())
        }
        responseBody.close()
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 9.8K bytes
    - Viewed (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/ResponseBodyJvmTest.kt

        assertThat(body.string()).isEqualTo("hello")
      }
    
      @Test
      fun stringClosesUnderlyingSource() {
        val closed = AtomicBoolean()
        val body: ResponseBody =
          object : ResponseBody() {
            override fun contentType(): MediaType? = null
    
            override fun contentLength(): Long = 5
    
            override fun source(): BufferedSource {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 12.4K bytes
    - Viewed (0)
  8. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

              },
            )
            throw e
          }
    
          val tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
    
          val responseBody = response.body!!
          val contentLength = responseBody.contentLength()
          val bodySize = if (contentLength != -1L) "$contentLength-byte" else "unknown-length"
          logger.log(
            buildString {
              append("<-- ${response.code}")
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Aug 21 14:27:04 UTC 2025
    - 11.4K bytes
    - Viewed (0)
  9. docs/changelogs/upgrading_to_okhttp_4.md

    | RequestBody.create(String)          | String.toRequestBody()          |
    | ResponseBody.create(BufferedSource) | BufferedSource.asResponseBody() |
    | ResponseBody.create(ByteArray)      | ByteArray.toResponseBody()      |
    | ResponseBody.create(ByteString)     | ByteString.toResponseBody()     |
    | ResponseBody.create(String)         | String.toResponseBody()         |
    
    
    SAM Conversions
    ---------------
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sun Feb 06 16:58:16 UTC 2022
    - 10.9K bytes
    - Viewed (0)
  10. okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt

              exceptions.add(e)
            }
          }
        }
    
        fun takeException(): Exception = exceptions.take()
      }
    
      companion object {
        fun uppercase(original: ResponseBody): ResponseBody =
          object : ResponseBody() {
            override fun contentType() = original.contentType()
    
            override fun contentLength() = original.contentLength()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 28.2K bytes
    - Viewed (0)
Back to top