Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 31 for ResponseBody (0.87 sec)

  1. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.6K 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. 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)
  4. 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)
  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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  6. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

    import com.squareup.moshi.Moshi;
    import com.squareup.moshi.Types;
    import java.util.Collections;
    import java.util.List;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    import okhttp3.ResponseBody;
    
    public class OkHttpContributors {
      private static final String ENDPOINT = "https://api.github.com/repos/square/okhttp/contributors";
      private static final Moshi MOSHI = new Moshi.Builder().build();
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  7. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 1.3K bytes
    - Viewed (0)
  8. okhttp-sse/src/main/kotlin/okhttp3/sse/internal/RealEventSource.kt

     * limitations under the License.
     */
    package okhttp3.sse.internal
    
    import java.io.IOException
    import okhttp3.Call
    import okhttp3.Callback
    import okhttp3.Request
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okhttp3.internal.stripBody
    import okhttp3.sse.EventSource
    import okhttp3.sse.EventSourceListener
    
    internal class RealEventSource(
      private val request: Request,
      private val listener: EventSourceListener,
    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)
  9. 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)
  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