Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 194 for body (0.18 sec)

  1. okhttp/src/test/java/okhttp3/DuplexTest.kt

        requestBody2.writeUtf8("request body\n")
        requestBody2.close()
        val responseBody2 = response2.body.source()
        assertThat(responseBody2.readUtf8Line())
          .isEqualTo("response body")
        assertTrue(responseBody2.exhausted())
        body.awaitSuccess()
    
        // No more requests attempted!
        (call.request().body as AsyncRequestBody?)!!.assertNoMoreSinks()
      }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/CacheTest.kt

            .addHeader(headerName, headerValue)
            .body("a")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .body("b")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .body("c")
            .build(),
        )
        val url = server.url("/")
        assertThat(get(url).body.string()).isEqualTo("a")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 108.6K bytes
    - Viewed (0)
  3. okhttp-coroutines/src/test/kotlin/okhttp3/coroutines/ExecuteAsyncTest.kt

        this.server = server
      }
    
      @Test
      fun suspendCall() {
        runTest {
          server.enqueue(MockResponse(body = "abc"))
    
          val call = client.newCall(request)
    
          call.executeAsync().use {
            withContext(Dispatchers.IO) {
              assertThat(it.body.string()).isEqualTo("abc")
            }
          }
        }
      }
    
      @Test
      fun timeoutCall() {
        runTest {
          server.enqueue(
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/-ResponseCommon.kt

          """.trimMargin(),
        )
      }
    
      override fun timeout() = Timeout.NONE
    
      override fun close() {
      }
    }
    
    fun Response.stripBody(): Response {
      return newBuilder()
        .body(UnreadableResponseBody(body.contentType(), body.contentLength()))
        .build()
    }
    
    val Response.commonIsSuccessful: Boolean
      get() = code in 200..299
    
    fun Response.commonHeaders(name: String): List<String> = headers.values(name)
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  5. 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(),
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
      public static void main(String... args) throws Exception {
        new RequestBodyCompression().run();
      }
    
      /** This interceptor compresses the HTTP request body. Many webservers can't handle this! */
      static class GzipRequestInterceptor implements Interceptor {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 3.8K bytes
    - Viewed (0)
  7. 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
          }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/EventListener.kt

       * body. This was misleading for tracing because it was too early.
       */
      open fun responseBodyStart(call: Call) {
      }
    
      /**
       * Invoked immediately after receiving a response body and completing reading it.
       *
       * Will only be invoked for requests having a response body e.g. won't be invoked for a web socket
       * upgrade.
       *
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 15.2K bytes
    - Viewed (0)
  9. mockwebserver/src/main/kotlin/mockwebserver3/MockWebServer.kt

        val body = response.body ?: return
        sleepNanos(response.bodyDelayNanos)
        val responseBodySink =
          sink.withThrottlingAndSocketPolicy(
            policy = response,
            disconnectHalfway = response.socketPolicy == DisconnectDuringResponseBody,
            expectedByteCount = body.contentLength,
            socket = socket,
          ).buffer()
        body.writeTo(responseBodySink)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 37.4K bytes
    - Viewed (0)
  10. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

        try (Response response = client.newCall(request).execute()) {
          // Deserialize HTTP response to concrete type.
          ResponseBody body = response.body();
          List<Contributor> contributors = CONTRIBUTORS_JSON_ADAPTER.fromJson(body.source());
    
          // Sort list by the most contributions.
          Collections.sort(contributors, (c1, c2) -> c2.contributions - c1.contributions);
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.2K bytes
    - Viewed (0)
Back to top