Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for Content (0.22 sec)

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

          FileInputStream(filePath.toFile()).use { fis ->
            fn(fis.fd)
          }
        }
      }
    
      private inline fun <T> assertOnPath(
        content: String? = null,
        fn: (okio.Path) -> T,
      ): T {
        FileSystem.SYSTEM.write(filePath) {
          if (content != null) {
            writeUtf8(content)
          }
        }
    
        return fn(filePath)
      }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  2. okhttp/src/main/kotlin/okhttp3/internal/http/RealResponseBody.kt

    import okhttp3.MediaType.Companion.toMediaTypeOrNull
    import okhttp3.ResponseBody
    import okio.BufferedSource
    
    class RealResponseBody(
      /**
       * Use a string to avoid parsing the content type until needed. This also defers problems caused
       * by malformed content types.
       */
      private val contentTypeString: String?,
      private val contentLength: Long,
      private val source: BufferedSource,
    ) : ResponseBody() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  3. mockwebserver/README.md

    You can set a custom body with a string, input stream or byte array. Also
    add headers with a fluent builder API.
    
    ```java
    MockResponse response = new MockResponse()
        .addHeader("Content-Type", "application/json; charset=utf-8")
        .addHeader("Cache-Control", "no-cache")
        .setBody("{}");
    ```
    
    MockResponse can be used to simulate a slow network. This is useful for
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 5K bytes
    - Viewed (1)
  4. samples/compare/src/test/kotlin/okhttp3/compare/JavaHttpClientTest.kt

        assertThat(recorded.headers["Connection"]).isEqualTo("Upgrade, HTTP2-Settings")
        if (PlatformVersion.majorVersion < 19) {
          assertThat(recorded.headers["Content-Length"]).isEqualTo("0")
        }
        assertThat(recorded.headers["HTTP2-Settings"]).isNotNull()
        assertThat(recorded.headers["Upgrade"]).isEqualTo("h2c") // HTTP/2 over plaintext!
    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)
  5. regression-test/src/androidTest/java/okhttp/regression/compare/AndroidHttpEngineTest.kt

     */
    @RunWith(AndroidJUnit4::class)
    @SdkSuppress(minSdkVersion = 34)
    class AndroidHttpEngineTest {
      val context = InstrumentationRegistry.getInstrumentation().context
    
      val cacheDir =
        context.cacheDir.resolve("httpEngine").also {
          it.mkdirs()
        }
      val engine =
        HttpEngine.Builder(context)
          .setEnableBrotli(true)
          .setStoragePath(cacheDir.path)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 24 13:19:43 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  6. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourcesHttpTest.kt

      @Test
      fun processResponse() {
        server.enqueue(
          MockResponse.Builder()
            .body(
              """
              |data: hey
              |
              |
              """.trimMargin(),
            ).setHeader("content-type", "text/event-stream")
            .build(),
        )
        val request =
          Request.Builder()
            .url(server.url("/"))
            .build()
        val response = client.newCall(request).execute()
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  7. okcurl/src/main/kotlin/okhttp3/curl/internal/-MainCommon.kt

            val parts = header.split(':', limit = 2)
            if ("Content-Type".equals(parts[0], ignoreCase = true)) {
              return@let parts[1].trim()
            }
          }
          return@let null
        } ?: "application/x-www-form-urlencoded"
    
      return mimeType.toMediaTypeOrNull()
    }
    
    private fun isSpecialHeader(s: String): Boolean {
      return s.equals("Content-Type", ignoreCase = true)
    }
    
    fun Main.commonRun() {
    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)
  8. okhttp/src/main/kotlin/okhttp3/internal/http/HttpHeaders.kt

        return false
      }
    
      val responseCode = code
      if ((responseCode < HTTP_CONTINUE || responseCode >= 200) &&
        responseCode != HTTP_NO_CONTENT &&
        responseCode != HTTP_NOT_MODIFIED
      ) {
        return true
      }
    
      // If the Content-Length or Transfer-Encoding headers disagree with the response code, the
      // response is malformed. For best compatibility, we honor the headers.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/HeadersTest.kt

          Headers.Builder()
            .add("content-length", "99")
            .add("authorization", "peanutbutter")
            .add("proxy-authorization", "chocolate")
            .add("cookie", "drink=coffee")
            .add("set-cookie", "accessory=sugar")
            .add("user-agent", "OkHttp")
            .build()
        assertThat(headers.toString()).isEqualTo(
          """
          |content-length: 99
          |authorization: ██
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 8.6K bytes
    - Viewed (0)
  10. okhttp-android/src/test/kotlin/okhttp3/android/RobolectricOkHttpClientTest.kt

    import org.robolectric.annotation.Config
    
    @RunWith(RobolectricTestRunner::class)
    @Config(
      sdk = [30],
    )
    class RobolectricOkHttpClientTest {
      private lateinit var context: Context
      private lateinit var client: OkHttpClient
    
      @Before
      fun setUp() {
        context = ApplicationProvider.getApplicationContext<Application>()
        client =
          OkHttpClient.Builder()
            .cache(Cache(FakeFileSystem(), "/cache".toPath(), 10_000_000))
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 2.5K bytes
    - Viewed (0)
Back to top