Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 21 - 30 of 48 for add_header (0.14 seconds)

  1. okhttp/src/jvmTest/kotlin/okhttp3/EventListenerTest.kt

        enableTlsWithTunnel()
        server.enqueue(
          MockResponse
            .Builder()
            .inTunnel()
            .code(407)
            .addHeader("Proxy-Authenticate: Basic realm=\"localhost\"")
            .addHeader("Connection: close")
            .build(),
        )
        server.enqueue(
          MockResponse
            .Builder()
            .inTunnel()
            .build(),
        )
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Nov 05 18:28:35 GMT 2025
    - 70.5K bytes
    - Click Count (0)
  2. mockwebserver/README.md

    ### Java
    ```java
    MockResponse response = new MockResponse.Builder()
        .addHeader("Content-Type", "application/json; charset=utf-8")
        .addHeader("Cache-Control", "no-cache")
        .body("{}")
        .build();
    ```
    
    ### Kotlin
    ```kotlin
    val response = MockResponse.Builder()
      .addHeader("Content-Type", "application/json; charset=utf-8")
      .addHeader("Cache-Control", "no-cache")
      .body("{}")
      .build()
    ```
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Oct 30 21:39:59 GMT 2025
    - 8.1K bytes
    - Click Count (0)
  3. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/KotlinSourceModernTest.kt

        var headers: Headers = mockResponse.headers
        var trailers: Headers = mockResponse.trailers
        mockResponse = mockResponse.clearHeaders()
        mockResponse = mockResponse.addHeader("")
        mockResponse = mockResponse.addHeader("", "")
        mockResponse = mockResponse.addHeaderLenient("", Any())
        mockResponse = mockResponse.setHeader("", Any())
        mockResponse.headers = headersOf()
        mockResponse.trailers = headersOf()
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.3K bytes
    - Click Count (0)
  4. impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/UpgradeContext.java

        // Indentation control for nested logging
        private int indentLevel = 0;
        private String indentString = Indentation.DEFAULT;
    
        public void addInHeader(String text) {
            addInHeader(AttributedStyle.DEFAULT, text);
        }
    
        public void addInHeader(AttributedStyle style, String text) {
            AttributedStringBuilder asb = new AttributedStringBuilder();
            asb.style(style).append(text);
    Created: Sun Dec 28 03:35:09 GMT 2025
    - Last Modified: Tue Nov 18 18:03:26 GMT 2025
    - 4.7K bytes
    - Click Count (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/DuplexTest.kt

        val body =
          MockSocketHandler()
            .sendResponse("ok")
            .exhaustResponse()
        server.enqueue(
          MockResponse
            .Builder()
            .clearHeaders()
            .addHeader("h1", "v1")
            .addHeader("h2", "v2")
            .trailers(headersOf("trailers", "boom"))
            .socketHandler(body)
            .build(),
        )
        val call =
          client.newCall(
            Request
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 19:13:52 GMT 2025
    - 25.8K bytes
    - Click Count (0)
  6. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

         * by a colon and a value.
         */
        public fun addHeader(header: String): Builder =
          apply {
            headers_.add(header)
          }
    
        /**
         * Adds a new header with the name and value. This may be used to add multiple headers with the
         * same name.
         */
        public fun addHeader(
          name: String,
          value: Any,
        ): Builder =
          apply {
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 17.8K bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/ConnectionCoalescingTest.kt

          execute(differentDnsUrl)
        }
      }
    
      @Test
      fun skipsOnRedirectWhenDnsDontMatch() {
        server.enqueue(
          MockResponse
            .Builder()
            .code(301)
            .addHeader("Location", url.newBuilder().host("differentdns.com").build())
            .build(),
        )
        server.enqueue(
          MockResponse
            .Builder()
            .body("unexpected call")
            .build(),
        )
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Jun 19 11:44:16 GMT 2025
    - 19.1K bytes
    - Click Count (0)
  8. okhttp-sse/src/main/kotlin/okhttp3/sse/EventSources.kt

      fun createFactory(callFactory: Call.Factory): EventSource.Factory =
        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)
          }
        }
    
      @JvmStatic
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Oct 03 07:51:20 GMT 2025
    - 1.6K bytes
    - Click Count (0)
  9. samples/slack/src/main/java/okhttp3/slack/OAuthSessionFactory.java

        }
    
        synchronized (this) {
          listeners.remove(state);
        }
    
        // Success!
        return new MockResponse()
            .setResponseCode(302)
            .addHeader("Location", "https://twitter.com/CuteEmergency/status/789457462864863232");
      }
    
      public interface Listener {
        void sessionGranted(OAuthSession session);
      }
    
      @Override public void close() {
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 3.8K bytes
    - Click Count (1)
  10. okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.kt

      private fun dnsResponse(s: String): MockResponse =
        MockResponse
          .Builder()
          .body(Buffer().write(s.decodeHex()))
          .addHeader("content-type", "application/dns-message")
          .addHeader("content-length", s.length / 2)
          .build()
    
      private fun buildLocalhost(
        bootstrapClient: OkHttpClient,
        includeIPv6: Boolean,
        post: Boolean = false,
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 19:13:52 GMT 2025
    - 11.9K bytes
    - Click Count (0)
Back to Top