Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for body (0.14 sec)

  1. container-tests/src/test/java/okhttp3/containers/SocksProxyTest.kt

              .build()
    
          val response =
            client.newCall(
              Request("http://mockserver:1080/person?name=peter".toHttpUrl()),
            ).execute()
    
          assertThat(response.body.string()).contains("Peter the person")
        }
      }
    
      companion object {
        val SOCKS5_PROXY: DockerImageName =
          DockerImageName
            .parse("serjs/go-socks5-proxy")
            .withTag("v0.0.3")
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/internal/publicsuffix/PublicSuffixListGenerator.kt

        withContext(Dispatchers.IO) {
          client.newCall(request).executeAsync().use { response ->
            fileSystem.sink(publicSuffixListDotDat).buffer().use { sink ->
              sink.writeAll(response.body.source())
            }
          }
        }
    
      private suspend fun readImportResults(): ImportResults =
        withContext(Dispatchers.IO) {
          val sortedRules: SortedSet<ByteString> = TreeSet()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 6K bytes
    - Viewed (0)
  3. container-tests/src/test/java/okhttp3/containers/BasicProxyTest.kt

          val client = OkHttpClient()
    
          val response =
            client.newCall(
              Request((mockServer.endpoint + "/person?name=peter").toHttpUrl()),
            ).execute()
    
          assertThat(response.body.string()).contains("Peter the person")
          assertThat(response.protocol).isEqualTo(Protocol.HTTP_1_1)
        }
      }
    
      @Test
      fun testOkHttpProxied() {
        testRequest {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 5.9K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/guide/PostExample.java

      String post(String url, String json) throws IOException {
        RequestBody body = RequestBody.create(json, JSON);
        Request request = new Request.Builder()
            .url(url)
            .post(body)
            .build();
        try (Response response = client.newCall(request).execute()) {
          return response.body().string();
        }
      }
    
      String bowlingJson(String player1, String player2) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2K bytes
    - Viewed (0)
  5. container-tests/src/test/java/okhttp3/containers/BasicMockServerTest.kt

            )
            .respond(response().withBody("Peter the person!"))
    
          val response = client.newCall(Request((mockServer.endpoint + "/person?name=peter").toHttpUrl())).execute()
    
          assertThat(response.body.string()).contains("Peter the person")
        }
      }
    
      @Test
      fun testHttpsRequest() {
        MockServerClient(mockServer.host, mockServer.serverPort).use { mockServerClient ->
          mockServerClient
            .`when`(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  6. okhttp-coroutines/src/test/kotlin/okhttp3/SuspendCallTest.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 12 11:42:09 GMT 2024
    - Last Modified: Fri Apr 05 11:25:23 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  7. okhttp-brotli/src/main/kotlin/okhttp3/brotli/internal/Uncompress.kt

        return response
      }
      val body = response.body
      val encoding = response.header("Content-Encoding") ?: return response
    
      val decompressedSource =
        when {
          encoding.equals("br", ignoreCase = true) ->
            BrotliInputStream(body.source().inputStream()).source().buffer()
          encoding.equals("gzip", ignoreCase = true) ->
            GzipSource(body.source()).buffer()
          else -> return response
        }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 13:19:01 GMT 2024
    - 1.5K bytes
    - Viewed (0)
  8. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  9. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 5.2K 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 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