Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for ResponseBody (0.37 sec)

  1. okhttp/src/main/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.
     *   }
     * });
     * ```
     *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

        assertThat(body.string()).isEqualTo("hello")
      }
    
      @Test
      fun stringClosesUnderlyingSource() {
        val closed = AtomicBoolean()
        val body: ResponseBody =
          object : ResponseBody() {
            override fun contentType(): MediaType? {
              return null
            }
    
            override fun contentLength(): Long {
              return 5
            }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  4. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  5. mockwebserver/src/main/kotlin/mockwebserver3/internal/duplex/RealStream.kt

    internal class RealStream(
      private val http2Stream: Http2Stream,
    ) : Stream {
      override val requestBody = http2Stream.getSource().buffer()
      override val responseBody = http2Stream.getSink().buffer()
    
      override fun cancel() {
        http2Stream.closeLater(ErrorCode.CANCEL)
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Dec 31 18:24:52 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/Callback.kt

       * Called when the HTTP response was successfully returned by the remote server. The callback may
       * proceed to read the response body with [Response.body]. The response is still live until its
       * response body is [closed][ResponseBody]. The recipient of the callback may consume the response
       * body on another thread.
       *
       * Note that transport-layer success (receiving a HTTP response code, headers and body) does not
    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. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 15.5K bytes
    - Viewed (0)
  8. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.1K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/internal/ws/WebSocketRecorder.kt

        cls: Class<out IOException?>?,
        message: String?,
      ) {
        val event = nextEvent() as Failure
        assertThat(event.response!!.code).isEqualTo(code)
        if (body != null) {
          assertThat(event.responseBody).isEqualTo(body)
        }
        assertThat(event.t.javaClass).isEqualTo(cls)
        assertThat(event.t.message).isEqualTo(message)
      }
    
      /** Expose this recorder as a frame callback and shim in "ping" events.  */
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6.9K bytes
    - Viewed (0)
  10. 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;
        }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 3.9K bytes
    - Viewed (0)
Back to top