Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 75 for MediaType (0.04 sec)

  1. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/UnreadableResponseBody.kt

     */
    package okhttp3.internal
    
    import okhttp3.MediaType
    import okhttp3.Response
    import okhttp3.ResponseBody
    import okio.Buffer
    import okio.Source
    import okio.Timeout
    import okio.buffer
    
    internal class UnreadableResponseBody(
      private val mediaType: MediaType?,
      private val contentLength: Long,
    ) : ResponseBody(),
      Source {
      override fun contentType() = mediaType
    
      override fun contentLength() = contentLength
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue May 27 15:19:53 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  2. samples/crawler/src/main/java/okhttp3/sample/Crawler.java

          String contentType = response.header("Content-Type");
          if (responseCode != 200 || contentType == null) {
            return;
          }
    
          MediaType mediaType = MediaType.parse(contentType);
          if (mediaType == null || !mediaType.subtype().equalsIgnoreCase("html")) {
            return;
          }
    
          Document document = Jsoup.parse(response.body().string(), url.toString());
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Jul 23 00:58:06 UTC 2025
    - 5K bytes
    - Viewed (0)
  3. 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
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 4.2K bytes
    - Viewed (1)
  4. 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;
              }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 47.8K bytes
    - Viewed (0)
  5. okhttp/src/jvmTest/kotlin/okhttp3/CallKotlinTest.kt

          override fun contentType(): MediaType = "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 = "application/xml".toMediaType()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 8.4K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/guide/PostExample.java

     * limitations under the License.
     */
    package okhttp3.guide;
    
    import java.io.IOException;
    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public class PostExample {
      public static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
    
      final OkHttpClient client = new OkHttpClient();
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Apr 05 03:30:42 UTC 2024
    - 2K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostMultipart.java

       * these examples, please request your own client ID! https://api.imgur.com/oauth2
       */
      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
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jun 24 12:59:42 UTC 2019
    - 2.2K bytes
    - Viewed (0)
  8. okhttp/src/jvmTest/kotlin/okhttp3/MediaTypeGetTest.kt

     * limitations under the License.
     */
    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 =
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Dec 27 13:39:56 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

       *
       * https://console.developers.google.com/project
       */
      public static final String GOOGLE_API_KEY = "AIzaSyAx2WZYe0My0i-uGurpvraYJxO7XNbwiGs";
      public static final MediaType MEDIA_TYPE_JSON = MediaType.get("application/json");
    
      private final OkHttpClient client = new OkHttpClient.Builder()
          .addInterceptor(new GzipRequestInterceptor())
          .build();
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Jun 04 17:43:43 UTC 2025
    - 3.1K bytes
    - Viewed (0)
  10. 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())
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jun 20 11:46:46 UTC 2025
    - 28.2K bytes
    - Viewed (0)
Back to top