Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 11 - 20 of 108 for mediaType (0.06 seconds)

  1. okhttp/src/commonJvmAndroid/kotlin/okhttp3/RequestBody.kt

        @JvmName("create")
        fun String.toRequestBody(contentType: MediaType? = null): RequestBody {
          val (charset, finalContentType) = contentType.chooseCharset()
          val bytes = toByteArray(charset)
          return bytes.toRequestBody(finalContentType, 0, bytes.size)
        }
    
        @JvmStatic
        @JvmName("create")
        fun ByteString.toRequestBody(contentType: MediaType? = null): RequestBody =
          object : RequestBody() {
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue Oct 07 14:16:29 GMT 2025
    - 9.3K bytes
    - Click Count (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/internal.kt

        cipherSuitesAsString.intersect(socketEnabledCipherSuites, CipherSuite.ORDER_BY_NAME)
      } else {
        socketEnabledCipherSuites
      }
    
    internal fun MediaType?.chooseCharset(): Pair<Charset, MediaType?> {
      var charset: Charset = Charsets.UTF_8
      var finalContentType: MediaType? = this
      if (this != null) {
        val resolvedCharset = this.charset()
        if (resolvedCharset == null) {
          charset = Charsets.UTF_8
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri May 30 21:28:20 GMT 2025
    - 3.7K bytes
    - Click Count (0)
  3. okcurl/src/main/kotlin/okhttp3/curl/internal/-MainCommon.kt

     * limitations under the License.
     */
    @file:Suppress("ktlint:standard:filename")
    
    package okhttp3.curl.internal
    
    import java.io.IOException
    import okhttp3.MediaType
    import okhttp3.MediaType.Companion.toMediaTypeOrNull
    import okhttp3.Request
    import okhttp3.RequestBody.Companion.toRequestBody
    import okhttp3.curl.Main
    import okhttp3.internal.http.StatusLine
    import okio.sink
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 2.7K bytes
    - Click Count (0)
  4. okhttp/src/jvmTest/kotlin/okhttp3/ResponseBodyTest.kt

    import okio.Source
    import okio.buffer
    
    class ResponseBodyTest {
      @Test
      fun sourceEmpty() {
        val mediaType = if (null == null) null else "any/thing; charset=${null}".toMediaType()
        val body = "".decodeHex().toResponseBody(mediaType)
        val source = body.source()
        assertThat(source.exhausted()).isTrue()
        assertThat(source.readUtf8()).isEqualTo("")
      }
    
      @Test
      fun sourceClosesUnderlyingSource() {
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 3.9K bytes
    - Click Count (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/KotlinDeprecationErrorTest.kt

        val keyPair: KeyPair = heldCertificate.keyPair()
      }
    
      @Test @Disabled
      fun mediaType() {
        val mediaType: MediaType = MediaType.get("")
        val type: String = mediaType.type()
        val subtype: String = mediaType.subtype()
        val parse: MediaType? = MediaType.parse("")
      }
    
      @Test @Disabled
      fun mockResponse() {
        val mockResponse = MockResponse()
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 13.3K bytes
    - Click Count (0)
  6. okhttp/api/android/okhttp.api

    	public static final fun create (Lokhttp3/MediaType;Lokio/ByteString;)Lokhttp3/RequestBody;
    	public static final fun create (Lokhttp3/MediaType;[B)Lokhttp3/RequestBody;
    	public static final fun create (Lokhttp3/MediaType;[BI)Lokhttp3/RequestBody;
    	public static final fun create (Lokhttp3/MediaType;[BII)Lokhttp3/RequestBody;
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Nov 05 18:28:35 GMT 2025
    - 70.3K bytes
    - Click Count (0)
  7. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/RealResponseBody.kt

     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package okhttp3.internal.http
    
    import okhttp3.MediaType
    import okhttp3.MediaType.Companion.toMediaTypeOrNull
    import okhttp3.ResponseBody
    import okio.BufferedSource
    
    class RealResponseBody(
      /**
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 1.2K bytes
    - Click Count (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/KotlinSourceModernTest.kt

      }
    
      @Test
      fun mediaType() {
        val mediaType: MediaType = "".toMediaType()
        val defaultCharset: Charset? = mediaType.charset()
        val charset: Charset? = mediaType.charset(Charsets.UTF_8)
        val type: String = mediaType.type
        val subtype: String = mediaType.subtype
        val parse: MediaType? = "".toMediaTypeOrNull()
      }
    
      @Test
      fun mockResponse() {
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Nov 05 18:28:35 GMT 2025
    - 47K bytes
    - Click Count (0)
  9. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

     */
    package okhttp3.recipes;
    
    import java.io.File;
    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public final class PostFile {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Click Count (0)
  10. samples/guide/src/main/java/okhttp3/recipes/UploadProgress.java

    import java.io.File;
    import java.io.IOException;
    
    public final class UploadProgress {
      private static final String IMGUR_CLIENT_ID = "9199fdef135c122";
      private static final MediaType MEDIA_TYPE_PNG = MediaType.get("image/png");
    
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        // Use the imgur image upload API as documented at https://api.imgur.com/endpoints/image
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat Aug 30 17:01:12 GMT 2025
    - 4.2K bytes
    - Click Count (1)
Back to Top