Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 56 for ResponseBody (0.2 sec)

  1. okhttp/src/test/java/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()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/ResponseJvmTest.kt

     */
    package okhttp3
    
    import assertk.assertThat
    import assertk.assertions.isEmpty
    import assertk.assertions.isEqualTo
    import kotlin.test.assertFailsWith
    import okhttp3.ResponseBody.Companion.asResponseBody
    import okhttp3.ResponseBody.Companion.toResponseBody
    import okio.Buffer
    import okio.BufferedSource
    import okio.Source
    import okio.Timeout
    import okio.buffer
    import org.junit.jupiter.api.Test
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.1K bytes
    - Viewed (0)
  3. okhttp/src/main/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() {
    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)
  4. okhttp/src/main/kotlin/okhttp3/Response.kt

       * from [Call.execute]. Response bodies must be [closed][ResponseBody] and may
       * be consumed only once.
       *
       * This always returns null on responses returned from [cacheResponse], [networkResponse],
       * and [priorResponse].
       */
      @get:JvmName("body") val body: ResponseBody,
      /**
       * Returns the raw response received from the network. Will be null if this response didn't use
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 15.5K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/http/BridgeInterceptor.kt

        if (transparentGzip &&
          "gzip".equals(networkResponse.header("Content-Encoding"), ignoreCase = true) &&
          networkResponse.promisesBody()
        ) {
          val responseBody = networkResponse.body
          if (responseBody != null) {
            val gzipSource = GzipSource(responseBody.source())
            val strippedHeaders =
              networkResponse.headers.newBuilder()
                .removeAll("Content-Encoding")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  6. mockwebserver/src/main/kotlin/mockwebserver3/Stream.kt

    @ExperimentalOkHttpApi
    interface Stream {
      val requestBody: BufferedSource
      val responseBody: BufferedSink
    
      /**
       * Terminate the stream so that no further data is transmitted or received. Note that
       * [requestBody] may return data after this call; that is the buffered data received before this
       * stream was canceled.
       *
       * This does nothing if [requestBody] and [responseBody] are already closed.
       *
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 1.3K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.kt

              .build(),
          )
        val response = call.execute()
        interruptLater(500)
        val responseBody = response.body.byteStream()
        val buffer = ByteArray(1024)
        assertFailsWith<IOException> {
          while (responseBody.read(buffer) != -1) {
          }
        }
        responseBody.close()
      }
    
      private fun sleep(delayMillis: Int) {
        try {
          Thread.sleep(delayMillis.toLong())
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  8. mockwebserver/src/main/kotlin/mockwebserver3/internal/duplex/MockStreamHandler.kt

        s: String,
        responseSent: CountDownLatch = CountDownLatch(0),
      ) = apply {
        actions += { stream ->
          stream.responseBody.writeUtf8(s)
          stream.responseBody.flush()
          responseSent.countDown()
        }
      }
    
      fun exhaustResponse() =
        apply {
          actions += { stream -> stream.responseBody.close() }
        }
    
      fun sleep(
        duration: Long,
        unit: TimeUnit,
      ) = apply {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  9. okhttp/src/test/java/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)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 46.5K bytes
    - Viewed (4)
  10. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

            logger.log("<-- HTTP FAILED: $e")
            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}")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
Back to top