Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for toMediaType (0.2 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  2. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  3. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3K bytes
    - Viewed (0)
  4. 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/MediaTypeGetTest.kt

     */
    package okhttp3
    
    import kotlin.test.assertEquals
    import kotlin.test.assertFailsWith
    import okhttp3.MediaType.Companion.toMediaType
    
    open class MediaTypeGetTest : MediaTypeTest() {
      override fun parse(string: String): MediaType = string.toMediaType()
    
      override fun assertInvalid(
        string: String,
        exceptionMessage: String?,
      ) {
        val e =
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.1K 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 May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/CallKotlinTest.kt

            return "application/xml".toMediaType()
          }
    
          override fun writeTo(sink: BufferedSink) {
            sink.writeUtf8("<el")
            sink.flush()
            throw IOException("failed to stream the XML")
          }
        }
    
        class ValidRequestBody : RequestBody() {
          override fun contentType(): MediaType {
            return "application/xml".toMediaType()
          }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/kt/PostStreaming.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.RequestBody
    import okio.BufferedSink
    
    class PostStreaming {
      private val client = OkHttpClient()
    
      fun run() {
        val requestBody =
    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)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/PostFile.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.File
    import java.io.IOException
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.RequestBody.Companion.asRequestBody
    
    class PostFile {
      private val client = OkHttpClient()
    
      fun run() {
        val file = File("README.md")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/kt/PostString.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.RequestBody.Companion.toRequestBody
    
    class PostString {
      private val client = OkHttpClient()
    
      fun run() {
        val postBody =
          """
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
Back to top