Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 47 for ResponseBody (0.19 sec)

  1. okhttp-testing-support/src/main/kotlin/okhttp3/ForwardingResponseBody.kt

     * limitations under the License.
     */
    package okhttp3
    
    import okio.BufferedSource
    
    open class ForwardingResponseBody(delegate: ResponseBody?) : ResponseBody() {
      private val delegate: ResponseBody
    
      fun delegate(): ResponseBody {
        return delegate
      }
    
      override fun contentType(): MediaType? {
        return delegate.contentType()
      }
    
      override fun contentLength(): Long {
    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)
  2. 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)
  3. okhttp/src/test/java/okhttp3/ResponseBodyTest.kt

        assertThat(source.exhausted()).isTrue()
        assertThat(source.readUtf8()).isEqualTo("")
      }
    
      @Test
      fun sourceClosesUnderlyingSource() {
        var closed = false
    
        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
    - 4K bytes
    - Viewed (0)
  4. 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)
  5. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  6. 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)
  7. okhttp/api/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;
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:41:01 GMT 2024
    - 70.2K bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. 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)
Back to top