Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 31 for toMediaType (0.24 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/kt/PostPath.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.RequestBody.Companion.asRequestBody
    import okio.Path.Companion.toPath
    import okio.buffer
    import okio.fakefilesystem.FakeFileSystem
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/RequestTest.kt

      }
    
      @Test
      fun stringWithDefaultCharsetAdded() {
        val contentType = "text/plain".toMediaType()
        val body = "\u0800".toRequestBody(contentType)
        assertThat(body.contentType()).isEqualTo("text/plain; charset=utf-8".toMediaType())
        assertThat(body.contentLength()).isEqualTo(3)
        assertThat(bodyToHex(body)).isEqualTo("e0a080")
      }
    
      @Test
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.4K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ResponseBodyTest.kt

     * limitations under the License.
     */
    package okhttp3
    
    import assertk.assertThat
    import assertk.assertions.isEqualTo
    import assertk.assertions.isTrue
    import kotlin.test.Test
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.ResponseBody.Companion.toResponseBody
    import okio.Buffer
    import okio.BufferedSource
    import okio.ByteString.Companion.decodeHex
    import okio.ByteString.Companion.encodeUtf8
    import okio.IOException
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/RequestBodyTest.kt

    import assertk.assertions.isEqualTo
    import assertk.assertions.isNull
    import java.io.FileDescriptor
    import java.io.FileInputStream
    import java.io.IOException
    import java.nio.file.Path
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.RequestBody.Companion.asRequestBody
    import okhttp3.RequestBody.Companion.toRequestBody
    import okio.Buffer
    import okio.FileSystem
    import okio.Path.Companion.toOkioPath
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  5. okhttp/src/test/java/okhttp3/MediaTypeJvmTest.kt

    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.internal.platform.Platform.Companion.isAndroid
    import org.junit.jupiter.api.Test
    
    class MediaTypeJvmTest : MediaTypeGetTest() {
      override fun MediaType.charsetName(): String? = this.charset()?.name()
    
      @Test fun testCharsetNameIsDoubleQuotedAndSingleQuotedAndroid() {
        val mediaType = "text/plain;charset=\"'utf-8'\"".toMediaType()
        if (isAndroid) {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/MediaType.kt

          message = "moved to extension function",
          replaceWith =
            ReplaceWith(
              expression = "mediaType.toMediaType()",
              imports = ["okhttp3.MediaType.Companion.toMediaType"],
            ),
          level = DeprecationLevel.ERROR,
        )
        fun get(mediaType: String): MediaType = mediaType.toMediaType()
    
        @JvmName("-deprecated_parse")
        @Deprecated(
          message = "moved to extension function",
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/CallTest.kt

    import okhttp3.CertificatePinner.Companion.pin
    import okhttp3.Credentials.basic
    import okhttp3.Headers.Companion.headersOf
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.RequestBody.Companion.toRequestBody
    import okhttp3.ResponseBody.Companion.asResponseBody
    import okhttp3.TestUtil.assumeNotWindows
    import okhttp3.TestUtil.awaitGarbageCollection
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 142.5K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/MultipartBodyTest.kt

    import assertk.assertions.isEqualTo
    import java.io.IOException
    import java.nio.charset.StandardCharsets
    import kotlin.test.assertFailsWith
    import okhttp3.Headers.Companion.headersOf
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.MediaType.Companion.toMediaTypeOrNull
    import okhttp3.RequestBody.Companion.toRequestBody
    import okio.Buffer
    import okio.BufferedSink
    import okio.utf8Size
    import org.junit.jupiter.api.Test
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

        val body = text.toResponseBody("text/plain; charset=unknown".toMediaType())
        assertThat(body.string()).isEqualTo(text)
      }
    
      companion object {
        @JvmOverloads
        fun body(
          hex: String,
          charset: String? = null,
        ): ResponseBody {
          val mediaType = if (charset == null) null else "any/thing; charset=$charset".toMediaType()
          return hex.decodeHex().toResponseBody(mediaType)
        }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/MultipartBody.kt

        @JvmField
        val MIXED = "multipart/mixed".toMediaType()
    
        /**
         * The "multipart/alternative" type is syntactically identical to "multipart/mixed", but the
         * semantics are different. In particular, each of the body parts is an "alternative" version of
         * the same information.
         */
        @JvmField
        val ALTERNATIVE = "multipart/alternative".toMediaType()
    
        /**
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.9K bytes
    - Viewed (0)
Back to top