Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 29 for mediaType (0.04 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. android/guava/src/com/google/common/net/MediaType.java

        MediaType mediaType = addKnownType(new MediaType(type, subtype, UTF_8_CONSTANT_PARAMETERS));
        mediaType.parsedCharset = Optional.of(UTF_8);
        return mediaType;
      }
    
      @CanIgnoreReturnValue
      private static MediaType addKnownType(MediaType mediaType) {
        knownTypes.put(mediaType, mediaType);
        return mediaType;
      }
    
      /*
       * The following constants are grouped by their type and ordered alphabetically by the constant
    Created: Fri Dec 26 12:43:10 GMT 2025
    - Last Modified: Thu Oct 02 01:46:40 GMT 2025
    - 48K bytes
    - Click Count (0)
  2. okhttp/src/jvmTest/kotlin/okhttp3/ResponseBodyJvmTest.kt

      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)
        }
    
        fun exhaust(reader: Reader): String {
          val builder = StringBuilder()
          val buf = CharArray(10)
          var read: Int
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 12.4K bytes
    - Click Count (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/ResponseBody.kt

        @JvmName("create")
        fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody =
          Buffer()
            .write(this)
            .asResponseBody(contentType, size.toLong())
    
        /** Returns a new response body that transmits this byte string. */
        @JvmStatic
        @JvmName("create")
        fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody =
          Buffer()
            .write(this)
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue May 27 14:51:25 GMT 2025
    - 11.6K bytes
    - Click Count (0)
  4. okhttp/src/commonJvmAndroid/kotlin/okhttp3/MultipartBody.kt

     */
    @Suppress("NAME_SHADOWING")
    class MultipartBody internal constructor(
      private val boundaryByteString: ByteString,
      @get:JvmName("type") val type: MediaType,
      @get:JvmName("parts") val parts: List<Part>,
    ) : RequestBody() {
      private val contentType: MediaType = "$type; boundary=$boundary".toMediaType()
      private var contentLength = -1L
    
      @get:JvmName("boundary")
      val boundary: String
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 10.9K bytes
    - Click Count (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/RequestTest.kt

            "}}",
        )
      }
    
      @Test
      fun gzip() {
        val mediaType = "text/plain; charset=utf-8".toMediaType()
        val originalBody = "This is the original message".toRequestBody(mediaType)
        assertThat(originalBody.contentLength()).isEqualTo(28L)
        assertThat(originalBody.contentType()).isEqualTo(mediaType)
    
        val request =
          Request
            .Builder()
            .url("https://square.com/")
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Oct 24 11:36:14 GMT 2025
    - 24.4K bytes
    - Click Count (0)
  6. docs/recipes.md

    === ":material-language-java: Java"
        ```java
          public static final MediaType MEDIA_TYPE_MARKDOWN
              = MediaType.parse("text/x-markdown; charset=utf-8");
    
          private final OkHttpClient client = new OkHttpClient();
    
          public void run() throws Exception {
            RequestBody requestBody = new RequestBody() {
              @Override public MediaType contentType() {
                return MEDIA_TYPE_MARKDOWN;
              }
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat Aug 30 17:01:12 GMT 2025
    - 47.8K bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/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
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 10.5K bytes
    - Click Count (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/InterceptorTest.kt

            val originalRequest = chain.request()
            val mediaType = "text/plain".toMediaType()
            val body = "abc".toRequestBody(mediaType)
            chain.proceed(
              originalRequest
                .newBuilder()
                .method("POST", body)
                .header("Content-Type", mediaType.toString())
                .header("Content-Length", body.contentLength().toString())
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 16:11:23 GMT 2025
    - 28.2K bytes
    - Click Count (0)
  9. fastapi/openapi/models.py

        content: Optional[dict[str, MediaType]] = None
    
    
    class Parameter(ParameterBase):
        name: str
        in_: ParameterInType = Field(alias="in")
    
    
    class Header(ParameterBase):
        pass
    
    
    class RequestBody(BaseModelWithConfig):
        description: Optional[str] = None
        content: dict[str, MediaType]
        required: Optional[bool] = None
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 15.1K bytes
    - Click Count (0)
  10. okhttp/src/jvmTest/kotlin/okhttp3/ServerTruncatesRequestTest.kt

      fun noAttemptToReadResponseIfLoadingRequestBodyIsSourceOfFailure() {
        server.enqueue(MockResponse(body = "abc"))
    
        val requestBody =
          object : RequestBody() {
            override fun contentType(): MediaType? = null
    
            override fun writeTo(sink: BufferedSink) {
              throw IOException("boom") // Despite this exception, 'sink' is healthy.
            }
          }
    
        val callA =
          client.newCall(
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Nov 04 19:13:52 GMT 2025
    - 10.4K bytes
    - Click Count (0)
Back to Top