Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 62 for responseBody (0.22 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/AsynchronousGet.java

          @Override public void onFailure(Call call, IOException e) {
            e.printStackTrace();
          }
    
          @Override public void onResponse(Call call, Response response) throws IOException {
            try (ResponseBody responseBody = response.body()) {
              if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
              Headers responseHeaders = response.headers();
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sun May 22 01:29:42 UTC 2016
    - 1.9K bytes
    - Viewed (0)
  2. okhttp-testing-support/src/main/kotlin/okhttp3/UppercaseResponseInterceptor.kt

      @Throws(IOException::class)
      override fun intercept(chain: Chain): Response = uppercaseResponse(chain.proceed(chain.request()))
    
      private fun uppercaseResponse(response: Response): Response {
        val uppercaseBody: ResponseBody =
          object : ForwardingResponseBody(response.body) {
            override fun source(): BufferedSource = uppercaseSource(delegate().source()).buffer()
          }
        return response
          .newBuilder()
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  3. okhttp-coroutines/src/test/kotlin/okhttp3/coroutines/ExecuteAsyncTest.kt

    import okhttp3.Callback
    import okhttp3.FailingCall
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.OkHttpClientTestRule
    import okhttp3.Protocol
    import okhttp3.Request
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okio.Buffer
    import okio.ForwardingSource
    import okio.buffer
    import org.junit.jupiter.api.Test
    import org.junit.jupiter.api.extension.RegisterExtension
    import org.junit.jupiter.api.fail
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  4. okhttp/src/jvmTest/kotlin/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.  */
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 6.8K bytes
    - Viewed (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt

              exceptions.add(e)
            }
          }
        }
    
        fun takeException(): Exception = exceptions.take()
      }
    
      companion object {
        fun uppercase(original: ResponseBody): ResponseBody =
          object : ResponseBody() {
            override fun contentType() = original.contentType()
    
            override fun contentLength() = original.contentLength()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 28.2K bytes
    - Viewed (0)
  6. okhttp/src/commonJvmAndroid/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")
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 4.2K bytes
    - Viewed (0)
  7. mockwebserver/src/main/kotlin/mockwebserver3/MockResponseBody.kt

     * limitations under the License.
     *
     */
    package mockwebserver3
    
    import java.io.IOException
    import okio.BufferedSink
    
    /**
     * The body of a [MockResponse].
     *
     * Unlike [okhttp3.ResponseBody], this interface is designed to be implemented by writers and not
     * called by readers.
     */
    public interface MockResponseBody {
      /** The length of this response in bytes, or -1 if unknown. */
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jun 14 16:09:26 UTC 2025
    - 1K bytes
    - Viewed (0)
  8. okhttp/src/commonJvmAndroid/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
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  9. okhttp/src/commonJvmAndroid/kotlin/okhttp3/CompressionInterceptor.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package okhttp3
    
    import okhttp3.CompressionInterceptor.DecompressionAlgorithm
    import okhttp3.ResponseBody.Companion.asResponseBody
    import okhttp3.internal.http.promisesBody
    import okio.BufferedSource
    import okio.GzipSource
    import okio.Source
    import okio.buffer
    
    /**
     * Transparent Compressed response support.
     *
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Aug 01 06:04:22 UTC 2025
    - 3.2K bytes
    - Viewed (0)
  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();
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Apr 05 03:30:42 UTC 2024
    - 2.2K bytes
    - Viewed (0)
Back to top