Search Options

Results per page
Sort
Preferred Languages
Advance

Results 91 - 100 of 188 for newBuilder (0.3 sec)

  1. okhttp/src/test/java/okhttp3/SessionReuseTest.kt

              return sslSocket.apply {
                if (reuseSession) {
                  this.enableSessionCreation = false
                }
              }
            }
          }
    
        client =
          client.newBuilder()
            .connectionSpecs(listOf(spec))
            .eventListenerFactory(
              clientTestRule.wrap(
                object : EventListener() {
                  override fun connectionAcquired(
                    call: Call,
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 6K bytes
    - Viewed (0)
  2. okhttp-sse/src/main/kotlin/okhttp3/sse/EventSources.kt

      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)
  3. okhttp/src/test/java/okhttp3/CacheTest.kt

        server.enqueue(
          response.newBuilder()
            .body("A")
            .status("HTTP/1.1 200 A-OK")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .code(HttpURLConnection.HTTP_NOT_MODIFIED)
            .build(),
        )
    
        // scenario 2: condition fails
        server.enqueue(
          response.newBuilder()
            .body("B")
    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)
  4. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.kt

            .code(401)
            .build(),
        )
        newEventSource()
        listener.assertFailure(null)
      }
    
      @Test
      fun fullCallTimeoutDoesNotApplyOnceConnected() {
        client =
          client.newBuilder()
            .callTimeout(250, TimeUnit.MILLISECONDS)
            .build()
        server.enqueue(
          MockResponse.Builder()
            .bodyDelay(500, TimeUnit.MILLISECONDS)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/Authenticate.java

              System.out.println("Challenges: " + response.challenges());
              String credential = Credentials.basic("jesse", "password1");
              return response.request().newBuilder()
                  .header("Authorization", credential)
                  .build();
            })
            .build();
      }
    
      public void run() throws Exception {
        Request request = new Request.Builder()
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 1.9K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/Authenticate.kt

                println("Authenticating for response: $response")
                println("Challenges: ${response.challenges()}")
                val credential = Credentials.basic("jesse", "password1")
                return response.request.newBuilder()
                  .header("Authorization", credential)
                  .build()
              }
            },
          )
          .build()
    
      fun run() {
        val request =
          Request.Builder()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  7. okhttp-testing-support/src/main/kotlin/okhttp3/UppercaseResponseInterceptor.kt

          object : ForwardingResponseBody(response.body) {
            override fun source(): BufferedSource {
              return uppercaseSource(delegate().source()).buffer()
            }
          }
        return response.newBuilder()
          .body(uppercaseBody)
          .build()
      }
    
      private fun uppercaseSource(source: BufferedSource): ForwardingSource {
        return object : ForwardingSource(source) {
          @Throws(IOException::class)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  8. docs/recipes.md

    All the HTTP client configuration lives in `OkHttpClient` including proxy settings, timeouts, and caches. When you need to change the configuration of a single call, call `OkHttpClient.newBuilder()`. This returns a builder that shares the same connection pool, dispatcher, and configuration with the original client. In the example below, we make one request with a 500 ms timeout and another with a 3000 ms timeout.
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Feb 18 08:52:22 GMT 2022
    - 40.2K bytes
    - Viewed (1)
  9. okhttp/src/main/kotlin/okhttp3/internal/cache/CacheStrategy.kt

          }
    
          val conditionalRequestHeaders = request.headers.newBuilder()
          conditionalRequestHeaders.addLenient(conditionName, conditionValue!!)
    
          val conditionalRequest =
            request.newBuilder()
              .headers(conditionalRequestHeaders.build())
              .build()
          return CacheStrategy(conditionalRequest, cacheResponse)
        }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 12K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/UrlComponentEncodingTester.kt

        component: Component,
      ) {
        val builder = "http://host/".toHttpUrl().newBuilder()
        assertFailsWith<IllegalArgumentException> {
          component[builder] = codePointString
        }
      }
    
      private fun testPunycode(
        codePointString: String,
        component: Component,
      ) {
        val builder = "http://host/".toHttpUrl().newBuilder()
        component[builder] = codePointString
        val url = builder.build()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 12.3K bytes
    - Viewed (0)
Back to top