Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 53 for ResponseBody (0.27 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/-ResponseBodyCommon.kt

    package okhttp3.internal
    
    import okhttp3.MediaType
    import okhttp3.ResponseBody
    import okhttp3.ResponseBody.Companion.asResponseBody
    import okio.Buffer
    import okio.BufferedSource
    import okio.ByteString
    import okio.IOException
    import okio.use
    
    internal fun ResponseBody.commonBytes() = commonConsumeSource(BufferedSource::readByteArray) { it.size }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/PrintEvents.java

    import okhttp3.EventListener;
    import okhttp3.Handshake;
    import okhttp3.HttpUrl;
    import okhttp3.OkHttpClient;
    import okhttp3.Protocol;
    import okhttp3.Request;
    import okhttp3.Response;
    import okhttp3.ResponseBody;
    
    public final class PrintEvents {
      private final OkHttpClient client = new OkHttpClient.Builder()
          .eventListenerFactory(PrintingEventListener.FACTORY)
          .build();
    
      public void run() throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 6.1K bytes
    - Viewed (0)
  3. okhttp/src/test/java/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()
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/MultipartReaderTest.kt

          |
          |abcd
          |--simple boundary--
          """.trimMargin()
            .replace("\n", "\r\n")
    
        val responseBody =
          multipart.toResponseBody(
            "application/multipart; boundary=\"simple boundary\"".toMediaType(),
          )
    
        val parts = MultipartReader(responseBody)
        assertThat(parts.boundary).isEqualTo("simple boundary")
    
        val part = parts.nextPart()!!
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13.8K bytes
    - Viewed (0)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/UppercaseResponseInterceptor.kt

      override fun intercept(chain: Chain): Response {
        return uppercaseResponse(chain.proceed(chain.request()))
      }
    
      private fun uppercaseResponse(response: Response): Response {
        val uppercaseBody: ResponseBody =
          object : ForwardingResponseBody(response.body) {
            override fun source(): BufferedSource {
              return uppercaseSource(delegate().source()).buffer()
            }
          }
        return response.newBuilder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  6. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  7. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 46.5K bytes
    - Viewed (4)
  8. okhttp-logging-interceptor/src/test/java/okhttp3/logging/HttpLoggingInterceptorTest.kt

              .post("Uncompressed".toRequestBody().gzip())
              .build(),
          ).execute()
        val responseBody = response.body
        assertThat(responseBody.string(), "Expected response body to be valid")
          .isEqualTo("Uncompressed")
        responseBody.close()
        networkLogs
          .assertLogEqual("--> POST $url http/1.1")
          .assertLogEqual("Content-Encoding: gzip")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 37.6K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/-ResponseCommon.kt

    import okhttp3.CacheControl
    import okhttp3.Headers
    import okhttp3.MediaType
    import okhttp3.Protocol
    import okhttp3.Request
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okhttp3.ResponseBody.Companion.asResponseBody
    import okhttp3.internal.http.HTTP_PERM_REDIRECT
    import okhttp3.internal.http.HTTP_TEMP_REDIRECT
    import okio.Buffer
    import okio.IOException
    import okio.Source
    import okio.Timeout
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/Call.kt

      /**
       * Invokes the request immediately, and blocks until the response can be processed or is in error.
       *
       * To avoid leaking resources callers should close the [Response] which in turn will close the
       * underlying [ResponseBody].
       *
       * ```java
       * // ensure the response (and underlying response body) is closed
       * try (Response response = client.newCall(request).execute()) {
       *   ...
       * }
       * ```
       *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 3.6K bytes
    - Viewed (0)
Back to top