Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 263 for response (0.17 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/http1/Http1ExchangeCodec.kt

      }
    
      override fun reportedContentLength(response: Response): Long {
        return when {
          !response.promisesBody() -> 0L
          response.isChunked -> -1L
          else -> response.headersContentLength()
        }
      }
    
      override fun openResponseBodySource(response: Response): Source {
        return when {
          !response.promisesBody() -> newFixedLengthSource(0)
          response.isChunked -> newChunkedSource(response.request.url)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.2K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/kt/CacheResponse.kt

            println("Response 2 response:          $it")
            println("Response 2 cache response:    ${it.cacheResponse}")
            println("Response 2 network response:  ${it.networkResponse}")
            return@use it.body.string()
          }
    
        println("Response 2 equals Response 1? " + (response1Body == response2Body))
      }
    }
    
    fun main() {
    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)
  3. okhttp/src/test/java/okhttp3/internal/ws/WebSocketRecorder.kt

        val webSocket: WebSocket,
        val response: Response,
      )
    
      internal class Failure(
        val t: Throwable,
        val response: Response?,
      ) {
        val responseBody: String? =
          when {
            response != null && response.code != 101 -> response.body.string()
            else -> null
          }
    
        override fun toString(): String {
          return when (response) {
            null -> "Failure[$t]"
    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)
  4. okhttp/src/test/java/okhttp3/CacheTest.kt

            .build()
        val response1 = client.newCall(request).execute()
        response1.body.close()
        assertThat(response1.header("X-Response-ID")).isEqualTo("1")
        val response2 = get(url)
        response2.body.close()
        if (expectCached) {
          assertThat(response2.header("X-Response-ID")).isEqualTo("1")
        } else {
          assertThat(response2.header("X-Response-ID")).isEqualTo("2")
        }
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 108.6K bytes
    - Viewed (0)
  5. docs/features/calls.md

    ## Rewriting Responses
    
    If transparent compression was used, OkHttp will drop the corresponding response headers `Content-Encoding` and `Content-Length` because they don’t apply to the decompressed response body.
    
    If a conditional GET was successful, responses from the network and cache are merged as directed by the spec.
    
    ## Follow-up 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)
  6. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

            "Mock Response",
          )
        for (i in 0..599) {
          val response = MockResponse().setResponseCode(i)
          val expectedReason = reasons[i / 100]
          assertThat(response.status).isEqualTo("HTTP/1.1 $i $expectedReason")
          assertThat(headersToList(response)).containsExactly("Content-Length: 0")
        }
      }
    
      @Test
      fun setStatusControlsWholeStatusLine() {
    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)
  7. container-tests/src/test/java/okhttp3/containers/BasicProxyTest.kt

      @Test
      fun testOkHttpDirect() {
        testRequest {
          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() {
    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)
  8. okhttp-logging-interceptor/src/test/java/okhttp3/logging/HttpLoggingInterceptorTest.kt

            }
          }
        val request =
          request()
            .post(asyncRequestBody)
            .build()
        val response = client.newCall(request).execute()
        Assumptions.assumeTrue(response.protocol == Protocol.HTTP_2)
        assertThat(response.body.string()).isEqualTo("Hello response!")
        applicationLogs
          .assertLogEqual("--> POST $url")
          .assertLogEqual("--> END POST (duplex request body omitted)")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 37.6K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/http/StatusLine.kt

          } else {
            append("HTTP/1.1")
          }
          append(' ').append(code)
          append(' ').append(message)
        }
      }
    
      companion object {
        fun get(response: Response): StatusLine {
          return StatusLine(response.protocol, response.code, response.message)
        }
    
        @Throws(IOException::class)
        fun parse(statusLine: String): StatusLine {
          // H T T P / 1 . 1   2 0 0   T e m p o r a r y   R e d i r e c t
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 09 12:33:05 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/CacheControl.kt

        /** Don't accept an unvalidated cached response. */
        fun noCache() = commonNoCache()
    
        /** Don't store the server's response in any cache. */
        fun noStore() = commonNoStore()
    
        /**
         * Only accept the response if it is in the cache. If the response isn't cached, a `504
         * Unsatisfiable Request` response will be returned.
         */
        fun onlyIfCached() = commonOnlyIfCached()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:41:01 GMT 2024
    - 10K bytes
    - Viewed (0)
Back to top