Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 160 for body (0.2 sec)

  1. 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)
  2. okhttp/src/main/kotlin/okhttp3/Cache.kt

      private inner class RealCacheRequest(
        private val editor: DiskLruCache.Editor,
      ) : CacheRequest {
        private val cacheOut: Sink = editor.newSink(ENTRY_BODY)
        private val body: Sink
        var done = false
    
        init {
          this.body =
            object : ForwardingSink(cacheOut) {
              @Throws(IOException::class)
              override fun close() {
                synchronized(this@Cache) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 26.8K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.kt

          MockResponse.Builder()
            .body(BIG_ENOUGH_BODY)
            .build(),
        )
        val request =
          Request.Builder()
            .url(server.url("/"))
            .build()
        val call = client.newCall(request)
        call.timeout().timeout(250, TimeUnit.MILLISECONDS)
        val response = call.execute()
        Thread.sleep(500)
        assertFailsWith<IOException> {
          response.body.source().readUtf8()
        }.also { expected ->
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/Call.kt

       *
       * ```java
       * // ensure the response (and underlying response body) is closed
       * try (Response response = client.newCall(request).execute()) {
       *   ...
       * }
       * ```
       *
       * The caller may read the response body with the response's [Response.body] method. To avoid
       * leaking resources callers must [close the response body][ResponseBody] or the response.
       *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/cache/CacheInterceptor.kt

        cacheRequest: CacheRequest?,
        response: Response,
      ): Response {
        // Some apps return a null body; for compatibility we treat that like a null cache request.
        if (cacheRequest == null) return response
        val cacheBodyUnbuffered = cacheRequest.body()
    
        val source = response.body.source()
        val cacheBody = cacheBodyUnbuffered.buffer()
    
        val cacheWritingSource =
          object : Source {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Mar 22 07:09:21 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/internal/ws/WebSocketRecorder.kt

        nextEvent() as Failure
      }
    
      fun assertFailure(
        code: Int,
        body: String?,
        cls: Class<out IOException?>?,
        message: String?,
      ) {
        val event = nextEvent() as Failure
        assertThat(event.response!!.code).isEqualTo(code)
        if (body != null) {
          assertThat(event.responseBody).isEqualTo(body)
        }
        assertThat(event.t.javaClass).isEqualTo(cls)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6.9K bytes
    - Viewed (0)
  7. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

        inputStream.close()
      }
    
      @Test
      fun disconnectRequestHalfway() {
        server.enqueue(MockResponse().setSocketPolicy(SocketPolicy.DISCONNECT_DURING_REQUEST_BODY))
        // Limit the size of the request body that the server holds in memory to an arbitrary
        // 3.5 MBytes so this test can pass on devices with little memory.
        server.bodyLimit = 7 * 512 * 1024
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 21.9K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/MultipartReader.kt

          closed = true
          currentPart = null
          source.close()
        }
    
        /** A single part in a multipart body. */
        class Part(
          @get:JvmName("headers") val headers: Headers,
          @get:JvmName("body") val body: BufferedSource,
        ) : Closeable by body
    
        internal companion object {
          /** These options follow the boundary. */
          val afterBoundaryOptions =
            Options.of(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.1K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/CacheCorruptionTest.kt

                formatDate(1, TimeUnit.HOURS)!!,
              ),
            body = "ABC.1",
          ),
        )
        server.enqueue(
          MockResponse(
            headers =
              headersOf(
                "Last-Modified",
                formatDate(-1, TimeUnit.HOURS)!!,
                "Expires",
                formatDate(1, TimeUnit.HOURS)!!,
              ),
            body = "ABC.2",
          ),
        )
        client =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 6K bytes
    - Viewed (1)
  10. 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)
Back to top