Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 54 for addHeader (0.11 sec)

  1. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

         * by a colon and a value.
         */
        fun addHeader(header: String) =
          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.
         */
        fun addHeader(
          name: String,
          value: Any,
        ) = apply {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Tue Jan 23 14:31:42 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/DuplexTest.kt

        val body =
          MockStreamHandler()
            .sendResponse("ok")
            .exhaustResponse()
        server.enqueue(
          MockResponse.Builder()
            .clearHeaders()
            .addHeader("h1", "v1")
            .addHeader("h2", "v2")
            .trailers(headersOf("trailers", "boom"))
            .streamHandler(body)
            .build(),
        )
        val call =
          client.newCall(
            Request.Builder()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 23.9K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

            .status("ICY 200 OK")
            .addHeader("Accept-Ranges: none")
            .addHeader("Content-Type: audio/mpeg")
            .addHeader("icy-br:128")
            .addHeader("ice-audio-info: bitrate=128;samplerate=44100;channels=2")
            .addHeader("icy-br:128")
            .addHeader("icy-description:Rock")
            .addHeader("icy-genre:riders")
            .addHeader("icy-name:A2RRock")
            .addHeader("icy-pub:1")
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 131.7K bytes
    - Viewed (0)
  4. 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()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  5. mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

          MockResponse()
            .clearHeaders()
            .addHeader("Cookie: s=square")
            .addHeader("Cookie", "a=android")
        assertThat(headersToList(response))
          .containsExactly("Cookie: s=square", "Cookie: a=android")
      }
    
      @Test
      fun mockResponseSetHeader() {
        val response =
          MockResponse()
            .clearHeaders()
            .addHeader("Cookie: s=square")
            .addHeader("Cookie: a=android")
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 21.9K bytes
    - Viewed (0)
  6. mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt

            .clearHeaders()
            .addHeader("Cookie: s=square")
            .addHeader("Cookie", "a=android")
        assertThat(headersToList(builder)).containsExactly("Cookie: s=square", "Cookie: a=android")
      }
    
      @Test
      fun mockResponseSetHeader() {
        val builder =
          MockResponse.Builder()
            .clearHeaders()
            .addHeader("Cookie: s=square")
            .addHeader("Cookie: a=android")
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/InterceptorTest.kt

          chain.proceed(
            originalRequest.newBuilder()
              .method("POST", uppercase(originalRequest.body))
              .addHeader("OkHttp-Intercepted", "yep")
              .build(),
          )
        }
        val request =
          Request.Builder()
            .url(server.url("/"))
            .addHeader("Original-Header", "foo")
            .method("PUT", "abc".toRequestBody("text/plain".toMediaType()))
            .build()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Jan 14 10:20:09 UTC 2024
    - 27.8K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/RequestTest.kt

        builder.header("AZab09~", "AZab09 ~")
        builder.addHeader("AZab09~", "AZab09 ~")
      }
    
      @Test
      fun emptyNameForbidden() {
        val builder = Request.Builder()
        assertFailsWith<IllegalArgumentException> {
          builder.header("", "Value")
        }
        assertFailsWith<IllegalArgumentException> {
          builder.addHeader("", "Value")
        }
      }
    
      @Test
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 16.4K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/EventListenerTest.kt

      @Test
      fun authenticatingTunnelProxyConnect() {
        enableTlsWithTunnel()
        server.enqueue(
          MockResponse.Builder()
            .inTunnel()
            .code(407)
            .addHeader("Proxy-Authenticate: Basic realm=\"localhost\"")
            .addHeader("Connection: close")
            .build(),
        )
        server.enqueue(
          MockResponse.Builder()
            .inTunnel()
            .build(),
        )
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 56.9K bytes
    - Viewed (2)
  10. 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()) {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun May 22 01:29:42 UTC 2016
    - 1.6K bytes
    - Viewed (0)
Back to top