Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 173 for body (0.13 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/kt/CacheResponse.kt

            println("Response 1 response:          $it")
            println("Response 1 cache response:    ${it.cacheResponse}")
            println("Response 1 network response:  ${it.networkResponse}")
            return@use it.body.string()
          }
    
        val response2Body =
          client.newCall(request).execute().use {
            if (!it.isSuccessful) throw IOException("Unexpected code $it")
    
            println("Response 2 response:          $it")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2K bytes
    - Viewed (2)
  2. docs/features/calls.md

    Each HTTP request contains a URL, a method (like `GET` or `POST`), and a list of headers. Requests may also contain a body: a data stream of a specific content type.
    
    ## [Responses](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-response/)
    
    The response answers the request with a code (like 200 for success or 404 for not found), headers, and its own optional body.
    
    ## Rewriting Requests
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 3.9K bytes
    - Viewed (0)
  3. mockwebserver-deprecated/src/main/kotlin/okhttp3/mockwebserver/SocketPolicy.kt

      SHUTDOWN_SERVER_AFTER_RESPONSE,
      KEEP_OPEN,
      DISCONNECT_AT_END,
      UPGRADE_TO_SSL_AT_END,
      DISCONNECT_AT_START,
      DISCONNECT_AFTER_REQUEST,
      DISCONNECT_DURING_REQUEST_BODY,
      DISCONNECT_DURING_RESPONSE_BODY,
      DO_NOT_READ_REQUEST_BODY,
      FAIL_HANDSHAKE,
      SHUTDOWN_INPUT_AT_END,
      SHUTDOWN_OUTPUT_AT_END,
      STALL_SOCKET_AT_START,
      NO_RESPONSE,
      RESET_STREAM_AT_START,
      EXPECT_CONTINUE,
      CONTINUE_ALWAYS,
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1K bytes
    - Viewed (0)
  4. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourcesHttpTest.kt

        this.server = server
      }
    
      @AfterEach
      fun after() {
        listener.assertExhausted()
      }
    
      @Test
      fun processResponse() {
        server.enqueue(
          MockResponse.Builder()
            .body(
              """
              |data: hey
              |
              |
              """.trimMargin(),
            ).setHeader("content-type", "text/event-stream")
            .build(),
        )
        val request =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  5. okcurl/src/main/kotlin/okhttp3/curl/internal/-MainCommon.kt

        }
    
        // Stream the response to the System.out as it is returned from the server.
        val out = System.out.sink()
        val source = response.body.source()
        while (!source.exhausted()) {
          out.write(source.buffer, source.buffer.size)
          out.flush()
        }
    
        response.body.close()
      } catch (e: IOException) {
        e.printStackTrace()
      } finally {
        close()
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  6. 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)
  7. android-test/src/androidTest/java/okhttp/android/test/sni/SniOverrideTest.kt

            .build()
        client.newCall(request).execute().use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(response.protocol).isEqualTo(Protocol.HTTP_2)
    
          assertThat(response.body.string()).contains("h=cloudflare-dns.com")
        }
      }
    
      @Test
      fun getWithDns() {
        client =
          client.newBuilder()
            .dns {
              Dns.SYSTEM.lookup("sni.cloudflaressl.com")
            }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.kt

      @Test
      @Throws(IOException::class)
      fun non101RetainsBody() {
        webServer.enqueue(
          MockResponse.Builder()
            .code(200)
            .body("Body")
            .build(),
        )
        newWebSocket()
        clientListener.assertFailure(
          200,
          "Body",
          ProtocolException::class.java,
          "Expected HTTP 101 response but was '200 OK'",
        )
      }
    
      @Test
      @Throws(IOException::class)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 35.2K bytes
    - Viewed (1)
  9. okhttp/src/test/java/okhttp3/RouteFailureTest.kt

      val refusedStream =
        MockResponse(
          socketPolicy = ResetStreamAtStart(ErrorCode.REFUSED_STREAM.httpCode),
        )
      val bodyResponse = MockResponse(body = "body")
    
      @BeforeEach
      fun setUp(
        server: MockWebServer,
        @MockWebServerInstance("server2") server2: MockWebServer,
      ) {
        this.server1 = server
        this.server2 = server2
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 11.9K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/KotlinDeprecationErrorTest.kt

      fun multipartBodyPart() {
        val multipartBody: MultipartBody = MultipartBody.Builder().build()
        val part: MultipartBody.Part = multipartBody.part(0)
        val headers: Headers? = part.headers()
        val body: RequestBody = part.body()
      }
    
      @Test @Disabled
      fun okHttpClient() {
        val client = OkHttpClient()
        val dispatcher: Dispatcher = client.dispatcher()
        val proxy: Proxy? = client.proxy()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13.3K bytes
    - Viewed (0)
Back to top