Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 75 for mediaTypes (0.07 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/http/RealResponseBody.kt

    1. * See the License for the specific language governing permissions and
    2. * limitations under the License.
    3. */
    4. package okhttp3.internal.http
    5.  
    6. import okhttp3.MediaType
    7. import okhttp3.MediaType.Companion.toMediaTypeOrNull
    8. import okhttp3.ResponseBody
    9. import okio.BufferedSource
    10.  
    11. class RealResponseBody(
    12. /**
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/PostMultipart.java

    1. * these examples, please request your own client ID! https://api.imgur.com/oauth2
    2. */
    3. private static final String IMGUR_CLIENT_ID = "9199fdef135c122";
    4. private static final MediaType MEDIA_TYPE_PNG = MediaType.get("image/png");
    5.  
    6. private final OkHttpClient client = new OkHttpClient();
    7.  
    8. public void run() throws Exception {
    9. // Use the imgur image upload API as documented at https://api.imgur.com/endpoints/image
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jun 24 12:59:42 UTC 2019
    - 2.2K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ResponseBodyTest.kt

    1. import okio.Source
    2. import okio.buffer
    3.  
    4. class ResponseBodyTest {
    5. @Test
    6. fun sourceEmpty() {
    7. val mediaType = if (null == null) null else "any/thing; charset=${null}".toMediaType()
    8. val body = "".decodeHex().toResponseBody(mediaType)
    9. val source = body.source()
    10. assertThat(source.exhausted()).isTrue()
    11. assertThat(source.readUtf8()).isEqualTo("")
    12. }
    13.  
    14. @Test
    15. fun sourceClosesUnderlyingSource() {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 4K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/-RequestBodyCommon.kt

    1. * limitations under the License.
    2. */
    3. @file:Suppress("ktlint:standard:filename")
    4.  
    5. package okhttp3.internal
    6.  
    7. import okhttp3.MediaType
    8. import okhttp3.RequestBody
    9. import okio.BufferedSink
    10. import okio.ByteString
    11.  
    12. fun ByteArray.commonToRequestBody(
    13. contentType: MediaType?,
    14. offset: Int,
    15. byteCount: Int,
    16. ): RequestBody {
    17. checkOffsetAndCount(size.toLong(), offset.toLong(), byteCount.toLong())
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/MediaTypeGetTest.kt

    1. * limitations under the License.
    2. */
    3. package okhttp3
    4.  
    5. import kotlin.test.assertEquals
    6. import kotlin.test.assertFailsWith
    7. import okhttp3.MediaType.Companion.toMediaType
    8.  
    9. open class MediaTypeGetTest : MediaTypeTest() {
    10. override fun parse(string: String): MediaType = string.toMediaType()
    11.  
    12. override fun assertInvalid(
    13. string: String,
    14. exceptionMessage: String?,
    15. ) {
    16. val e =
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/CommonRequestBodyTest.kt

    1. class CommonRequestBodyTest {
    2. @Test
    3. fun correctContentType() {
    4. val body = "Body"
    5. val requestBody = body.toRequestBody(MediaType("text/plain", "text", "plain", arrayOf()))
    6.  
    7. val contentType = requestBody.contentType()!!
    8.  
    9. assertThat(contentType.mediaType).isEqualTo("text/plain; charset=utf-8")
    10. assertThat(contentType.parameter("charset")).isEqualTo("utf-8")
    11. }
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Wed Dec 20 23:27:07 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostStreamingWithPipe.java

    1. package okhttp3.recipes;
    2.  
    3. import java.io.IOException;
    4. import okhttp3.MediaType;
    5. import okhttp3.OkHttpClient;
    6. import okhttp3.Request;
    7. import okhttp3.RequestBody;
    8. import okhttp3.Response;
    9. import okio.BufferedSink;
    10. import okio.Okio;
    11. import okio.Pipe;
    12.  
    13. public final class PostStreamingWithPipe {
    14. public static final MediaType MEDIA_TYPE_MARKDOWN
    15. = MediaType.get("text/x-markdown; charset=utf-8");
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Fri Jul 06 03:18:15 UTC 2018
    - 3.1K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

    1. }
    2.  
    3. @Test
    4. fun mediaType() {
    5. val mediaType: MediaType = "".toMediaType()
    6. val defaultCharset: Charset? = mediaType.charset()
    7. val charset: Charset? = mediaType.charset(Charsets.UTF_8)
    8. val type: String = mediaType.type
    9. val subtype: String = mediaType.subtype
    10. val parse: MediaType? = "".toMediaTypeOrNull()
    11. }
    12.  
    13. @Test
    14. fun mockResponse() {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 01 14:21:25 UTC 2024
    - 46.5K bytes
    - Viewed (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/internal/duplex/AsyncRequestBody.kt

    1. */
    2. package okhttp3.internal.duplex
    3.  
    4. import java.util.concurrent.BlockingQueue
    5. import java.util.concurrent.LinkedBlockingQueue
    6. import java.util.concurrent.TimeUnit.SECONDS
    7. import okhttp3.MediaType
    8. import okhttp3.RequestBody
    9. import okio.BufferedSink
    10. import org.junit.jupiter.api.Assertions.assertTrue
    11.  
    12. /** A duplex request body that keeps the provided sinks so they can be written to later. */
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Wed Dec 20 23:27:07 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/PostString.java

    1. */
    2. package okhttp3.recipes;
    3.  
    4. import java.io.IOException;
    5. import okhttp3.MediaType;
    6. import okhttp3.OkHttpClient;
    7. import okhttp3.Request;
    8. import okhttp3.RequestBody;
    9. import okhttp3.Response;
    10.  
    11. public final class PostString {
    12. public static final MediaType MEDIA_TYPE_MARKDOWN
    13. = MediaType.get("text/x-markdown; charset=utf-8");
    14.  
    15. private final OkHttpClient client = new OkHttpClient();
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat May 25 18:02:55 UTC 2019
    - 1.7K bytes
    - Viewed (0)
Back to top