Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 577 for Accept (0.44 sec)

  1. samples/compare/src/test/kotlin/okhttp3/compare/ApacheHttpClientTest.kt

        val request = HttpGet(server.url("/").toUri())
        request.addHeader("Accept", "text/plain")
    
        httpClient.execute(request).use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(EntityUtils.toString(response.entity)).isEqualTo("hello, Apache HttpClient 5.x")
        }
    
        val recorded = server.takeRequest()
        assertThat(recorded.headers["Accept"]).isEqualTo("text/plain")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  2. samples/compare/src/test/kotlin/okhttp3/compare/JavaHttpClientTest.kt

          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")
    
        val recorded = server.takeRequest()
        assertThat(recorded.headers["Accept"]).isEqualTo("text/plain")
    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)
  3. okhttp-sse/src/main/kotlin/okhttp3/sse/EventSources.kt

      @JvmStatic
      fun createFactory(callFactory: Call.Factory): EventSource.Factory {
        return EventSource.Factory { request, listener ->
          val actualRequest =
            if (request.header("Accept") == null) {
              request.newBuilder().addHeader("Accept", "text/event-stream").build()
            } else {
              request
            }
    
          RealEventSource(actualRequest, listener).apply {
            connect(callFactory)
          }
        }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:18:15 GMT 2024
    - 1.6K bytes
    - Viewed (1)
  4. okhttp/src/test/java/okhttp3/internal/http2/MockHttp2Peer.kt

          }
        }
      }
    
      private fun readAndWriteFrames() {
        check(socket == null)
        val socket = serverSocket!!.accept()!!
        this.socket = socket
    
        // Bail out now if this instance was closed while waiting for the socket to accept.
        synchronized(this) {
          if (executor.isShutdown) {
            socket.close()
            return
          }
        }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  5. okhttp-brotli/src/main/kotlin/okhttp3/brotli/BrotliInterceptor.kt

    /**
     * Transparent Brotli response support.
     *
     * Adds Accept-Encoding: br to request and checks (and strips) for Content-Encoding: br in
     * responses.  n.b. this replaces the transparent gzip compression in BridgeInterceptor.
     */
    object BrotliInterceptor : Interceptor {
      override fun intercept(chain: Interceptor.Chain): Response {
        return if (chain.request().header("Accept-Encoding") == null) {
          val request =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.3K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/internal/http/BridgeInterceptor.kt

        }
    
        // If we add an "Accept-Encoding: gzip" header field we're responsible for also decompressing
        // the transfer stream.
        var transparentGzip = false
        if (userRequest.header("Accept-Encoding") == null && userRequest.header("Range") == null) {
          transparentGzip = true
          requestBuilder.header("Accept-Encoding", "gzip")
        }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  7. samples/guide/src/main/java/okhttp3/recipes/kt/AccessHeaders.kt

      fun run() {
        val request =
          Request.Builder()
            .url("https://api.github.com/repos/square/okhttp/issues")
            .header("User-Agent", "OkHttp Headers.java")
            .addHeader("Accept", "application/json; q=0.5")
            .addHeader("Accept", "application/vnd.github.v3+json")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/AccessHeaders.java

        Request request = new Request.Builder()
            .url("https://api.github.com/repos/square/okhttp/issues")
            .header("User-Agent", "OkHttp Headers.java")
            .addHeader("Accept", "application/json; q=0.5")
            .addHeader("Accept", "application/vnd.github.v3+json")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.6K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/http2/Hpack.kt

          Header(RESPONSE_STATUS, "400"),
          Header(RESPONSE_STATUS, "404"),
          Header(RESPONSE_STATUS, "500"),
          Header("accept-charset", ""),
          Header("accept-encoding", "gzip, deflate"),
          Header("accept-language", ""),
          Header("accept-ranges", ""),
          Header("accept", ""),
          Header("access-control-allow-origin", ""),
          Header("age", ""),
          Header("allow", ""),
          Header("authorization", ""),
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 22.5K bytes
    - Viewed (1)
  10. okhttp/src/test/java/okhttp3/CookiesTest.kt

      @BeforeEach
      fun setUp(server: MockWebServer) {
        this.server = server
      }
    
      @Test
      fun testNetscapeResponse() {
        val cookieManager = CookieManager(null, CookiePolicy.ACCEPT_ORIGINAL_SERVER)
        client =
          client.newBuilder()
            .cookieJar(JavaNetCookieJar(cookieManager))
            .build()
        val urlWithIpAddress = urlWithIpAddress(server, "/path/foo")
        server.enqueue(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
Back to top