Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 87 for MediaType (0.24 sec)

  1. okhttp/src/test/java/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() {
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 4K bytes
    - Viewed (1)
  2. okhttp/src/main/kotlin/okhttp3/internal/-RequestBodyCommon.kt

     * limitations under the License.
     */
    @file:Suppress("ktlint:standard:filename")
    
    package okhttp3.internal
    
    import okhttp3.MediaType
    import okhttp3.RequestBody
    import okio.BufferedSink
    import okio.ByteString
    
    fun ByteArray.commonToRequestBody(
      contentType: MediaType?,
      offset: Int,
      byteCount: Int,
    ): RequestBody {
      checkOffsetAndCount(size.toLong(), offset.toLong(), byteCount.toLong())
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/ResponseBody.kt

        @JvmStatic
        @JvmName("create")
        fun ByteArray.toResponseBody(contentType: MediaType? = null): ResponseBody = commonToResponseBody(contentType)
    
        /** Returns a new response body that transmits this byte string. */
        @JvmStatic
        @JvmName("create")
        fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody = commonToResponseBody(contentType)
    
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  4. platforms/documentation/docs/src/samples/templates/structuring-software-projects/server-application/app/src/main/java/com/example/myproduct/server/MyProductJsonController.java

    import com.example.myproduct.user.table.TableBuilder;
    
    import org.springframework.http.MediaType;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    import java.util.List;
    
    @RestController
    public class MyProductJsonController {
    
        @RequestMapping(value = "/json", produces = MediaType.APPLICATION_JSON_VALUE)
        public List<List<String>> json() {
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Mon Nov 27 17:53:42 UTC 2023
    - 511 bytes
    - Viewed (0)
  5. 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: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Fri Apr 05 03:30:42 UTC 2024
    - 2K bytes
    - Viewed (0)
  6. okhttp/src/test/java/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: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  7. okhttp/src/test/java/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()
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/CommonRequestBodyTest.kt

    class CommonRequestBodyTest {
      @Test
      fun correctContentType() {
        val body = "Body"
        val requestBody = body.toRequestBody(MediaType("text/plain", "text", "plain", arrayOf()))
    
        val contentType = requestBody.contentType()!!
    
        assertThat(contentType.mediaType).isEqualTo("text/plain; charset=utf-8")
        assertThat(contentType.parameter("charset")).isEqualTo("utf-8")
      }
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Wed Dec 20 23:27:07 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/-ResponseCommon.kt

    import okio.Buffer
    import okio.IOException
    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
    
      override fun source() = buffer()
    
      override fun read(
        sink: Buffer,
        byteCount: Long,
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Mon Apr 15 13:24:48 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  10. okhttp-testing-support/src/main/kotlin/okhttp3/internal/duplex/AsyncRequestBody.kt

     */
    package okhttp3.internal.duplex
    
    import java.util.concurrent.BlockingQueue
    import java.util.concurrent.LinkedBlockingQueue
    import java.util.concurrent.TimeUnit.SECONDS
    import okhttp3.MediaType
    import okhttp3.RequestBody
    import okio.BufferedSink
    import org.junit.jupiter.api.Assertions.assertTrue
    
    /** A duplex request body that keeps the provided sinks so they can be written to later.  */
    Registered: Sun Jun 16 04:42:17 UTC 2024
    - Last Modified: Wed Dec 20 23:27:07 UTC 2023
    - 1.5K bytes
    - Viewed (0)
Back to top