Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 193 for BODY (0.2 sec)

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

    class ResponseBodyJvmTest {
      @Test
      fun stringEmpty() {
        val body = body("")
        assertThat(body.string()).isEqualTo("")
      }
    
      @Test
      fun stringLooksLikeBomButTooShort() {
        val body = body("000048")
        assertThat(body.string()).isEqualTo("\u0000\u0000H")
      }
    
      @Test
      fun stringDefaultsToUtf8() {
        val body = body("68656c6c6f")
        assertThat(body.string()).isEqualTo("hello")
      }
    
      @Test
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

            Request(
              url = server.url("/"),
              body = body.toRequestBody(),
            ),
          )
        assertThat(response.code).isEqualTo(200)
        response.body.byteStream().close()
        val recordedRequest1 = server.takeRequest()
        assertThat(recordedRequest1.method).isEqualTo("POST")
        assertThat(recordedRequest1.body.readUtf8()).isEqualTo(body)
        assertThat(recordedRequest1.headers["Authorization"]).isNull()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

        server.enqueue(
          MockResponse(
            body = "abc",
            socketPolicy = DoNotReadRequestBody(ErrorCode.NO_ERROR.httpCode),
          ),
        )
    
        val call =
          client.newCall(
            Request(
              url = server.url("/"),
              body = SlowRequestBody,
            ),
          )
    
        call.execute().use { response ->
          assertThat(response.body.string()).isEqualTo("abc")
        }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  4. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

              logger.log("--> END ${request.method} (encoded body omitted)")
            } else if (requestBody.isDuplex()) {
              logger.log("--> END ${request.method} (duplex request body omitted)")
            } else if (requestBody.isOneShot()) {
              logger.log("--> END ${request.method} (one-shot body omitted)")
            } else {
              var buffer = Buffer()
              requestBody.writeTo(buffer)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  5. okhttp/src/main/kotlin/okhttp3/Callback.kt

       * 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 Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/internal/http/ExternalHttp2Example.kt

        try {
          println(response.code)
          println("PROTOCOL ${response.protocol}")
          var line: String?
          while (response.body.source().readUtf8Line().also { line = it } != null) {
            println(line)
          }
        } finally {
          response.body.close()
        }
        client.connectionPool.evictAll()
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  7. docs/features/events.md

    try (Response response = client.newCall(request).execute()) {
      // Consume and discard the response body.
      response.body().source().readByteString();
    }
    
    System.out.println("REQUEST 2 (pooled connection)");
    try (Response response = client.newCall(request).execute()) {
      // Consume and discard the response body.
      response.body().source().readByteString();
    }
    ```
    
    And the listener prints the corresponding events:
    
    ```
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 7.7K bytes
    - Viewed (0)
  8. mockwebserver/README.md

    ```
    
    Your unit tests might move the `server` into a field so you can shut it down
    from your test's `tearDown()`.
    
    ### API
    
    #### MockResponse
    
    Mock responses default to an empty response body and a `200` status code.
    You can set a custom body with a string, input stream or byte array. Also
    add headers with a fluent builder API.
    
    ```java
    MockResponse response = new MockResponse()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 5K bytes
    - Viewed (1)
  9. okhttp/src/main/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
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 17.9K bytes
    - Viewed (2)
  10. samples/compare/src/test/kotlin/okhttp3/compare/JavaHttpClientTest.kt

          MockResponse.Builder()
            .body("hello, Java HTTP Client")
            .build(),
        )
    
        val request =
          HttpRequest.newBuilder(server.url("/").toUri())
            .header("Accept", "text/plain")
            .build()
    
        val response = httpClient.send(request, BodyHandlers.ofString())
        assertThat(response.statusCode()).isEqualTo(200)
        assertThat(response.body()).isEqualTo("hello, Java HTTP Client")
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.7K bytes
    - Viewed (0)
Back to top