Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for tbody (0.01 sec)

  1. docs/recipes.md

    Download a file, print its headers, and print its response body as a string.
    
    The `string()` method on response body is convenient and efficient for small documents. But if the response body is large (greater than 1 MiB), avoid `string()` because it will load the entire document into memory. In that case, prefer to process the body as a stream.
    
    === ":material-language-kotlin: Kotlin"
        ```kotlin
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 47.8K bytes
    - Viewed (0)
  2. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.kt

            .setHeader("content-type", "text/event-stream")
            .body("data: hey\n\n")
            .build(),
        )
        newEventSource()
        listener.assertFailure("timeout")
      }
    
      @Test
      fun retainsAccept() {
        server.enqueue(
          MockResponse
            .Builder()
            .body(
              """
              |data: hey
              |
              |
              """.trimMargin(),
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:47:47 UTC 2025
    - 8.1K bytes
    - Viewed (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/RealCall.kt

      // the call, but they may be accessed by other threads for duplex requests.
    
      /** True if this call still has a request body open. */
      private var requestBodyOpen = false
    
      /** True if this call still has a response body open. */
      private var responseBodyOpen = false
    
      /** True if there are more exchanges expected for this call. */
      private var expectMoreExchanges = true
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:30:11 UTC 2025
    - 17.8K bytes
    - Viewed (0)
  4. okhttp-sse/src/main/kotlin/okhttp3/sse/internal/RealEventSource.kt

          if (!response.isSuccessful) {
            listener.onFailure(this, null, response)
            return
          }
    
          val body = response.body
    
          if (!body.isEventStream()) {
            listener.onFailure(
              this,
              IllegalStateException("Invalid content-type: ${body.contentType()}"),
              response,
            )
            return
          }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:47:47 UTC 2025
    - 3.3K bytes
    - Viewed (0)
  5. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourcesHttpTest.kt

      fun failureWith401IsReadable() {
        server.enqueue(
          MockResponse(
            code = 401,
            body = "{\"error\":{\"message\":\"No auth credentials found\",\"code\":401}}",
            headers = Headers.headersOf("content-type", "application/json"),
          ),
        )
        server.enqueue(
          MockResponse(
            body =
              """
              |data: hey
              |
              |
              """.trimMargin(),
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 13:49:38 UTC 2025
    - 3.6K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/UploadProgress.kt

            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
          println(response.body.string())
        }
      }
    
      private class ProgressRequestBody(
        private val delegate: RequestBody,
        private val progressListener: ProgressListener,
      ) : RequestBody() {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  7. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceFactoryTest.java

        OkHttpClient client = new OkHttpClient();
        EventSource.Factory factory = EventSource.Factory.create(client);
        server.enqueue(
          new MockResponse.Builder()
            .body("data: hello\n\n")
            .setHeader("content-type", "text/event-stream")
            .build()
        );
        Request request = new Request.Builder().url(server.url("/")).build();
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:47:47 UTC 2025
    - 2.8K bytes
    - Viewed (0)
  8. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceRecorder.kt

      override fun onFailure(
        eventSource: EventSource,
        t: Throwable?,
        response: Response?,
      ) {
        get().log("[ES] onFailure", Platform.INFO, t)
        events.add(Failure(t, response, t?.message ?: response?.body?.string()))
        drainCancelQueue(eventSource)
      }
    
      private fun drainCancelQueue(eventSource: EventSource) {
        if (cancel) {
          cancel = false
          eventSource.cancel()
        }
      }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:32:52 UTC 2025
    - 3.2K bytes
    - Viewed (0)
  9. okhttp/src/jvmTest/kotlin/okhttp3/internal/http/ThreadInterruptTest.kt

            Request
              .Builder()
              .url(server.url("/"))
              .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()
      }
    
      @Test
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:30:11 UTC 2025
    - 6.1K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/UploadProgress.java

          .build();
    
        Response response = client.newCall(request).execute();
        if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
        System.out.println(response.body().string());
      }
    
      public static void main(String... args) throws Exception {
        new UploadProgress().run();
      }
    
      private static class ProgressRequestBody extends RequestBody {
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 4.2K bytes
    - Viewed (1)
Back to top