Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 51 for ResponseBody (0.15 sec)

  1. 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)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/UnreadableResponseBody.kt

     */
    package okhttp3.internal
    
    import okhttp3.MediaType
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okio.Buffer
    import okio.Source
    import okio.Timeout
    import okio.buffer
    
    internal class UnreadableResponseBody(
      private val mediaType: MediaType?,
      private val contentLength: Long,
    ) : ResponseBody(),
      Source {
      override fun contentType() = mediaType
    
      override fun contentLength() = contentLength
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue May 27 15:19:53 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  3. 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)
  4. samples/guide/src/main/java/okhttp3/recipes/Progress.java

      }
    
      private static class ProgressResponseBody extends ResponseBody {
    
        private final ResponseBody responseBody;
        private final ProgressListener progressListener;
        private BufferedSource bufferedSource;
    
        ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
          this.responseBody = responseBody;
          this.progressListener = progressListener;
        }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jan 12 03:31:36 UTC 2019
    - 3.9K bytes
    - Viewed (0)
  5. 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)
  6. okhttp/api/android/okhttp.api

    	public final fun create (Lokhttp3/MediaType;JLokio/BufferedSource;)Lokhttp3/ResponseBody;
    	public final fun create (Lokhttp3/MediaType;Ljava/lang/String;)Lokhttp3/ResponseBody;
    	public final fun create (Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/ResponseBody;
    	public final fun create (Lokhttp3/MediaType;[B)Lokhttp3/ResponseBody;
    	public final fun create (Lokio/BufferedSource;Lokhttp3/MediaType;J)Lokhttp3/ResponseBody;
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 16 09:39:51 UTC 2025
    - 69.4K bytes
    - Viewed (0)
  7. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/RealResponseBody.kt

    import okhttp3.ResponseBody
    import okio.BufferedSource
    
    class RealResponseBody(
      /**
       * Use a string to avoid parsing the content type until needed. This also defers problems caused
       * by malformed content types.
       */
      private val contentTypeString: String?,
      private val contentLength: Long,
      private val source: BufferedSource,
    ) : ResponseBody() {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 1.2K 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/commonJvmAndroid/kotlin/okhttp3/internal/http/CallServerInterceptor.kt

                if (isUpgradeRequest) {
                  exchange.noRequestBody() // Failed upgrade request has no outbound data.
                }
                val responseBody = exchange.openResponseBody(response)
                response
                  .newBuilder()
                  .body(responseBody)
                  .trailers(
                    object : TrailersSource {
                      override fun peek() = exchange.peekTrailers()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 22:04:11 UTC 2025
    - 7.8K bytes
    - Viewed (0)
Back to top