Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 96 for contentTypes (0.2 sec)

  1. okhttp/src/main/kotlin/okhttp3/internal/-RequestBodyCommon.kt

    import okio.BufferedSink
    import okio.ByteString
    
    fun ByteArray.commonToRequestBody(
      contentType: MediaType?,
      offset: Int,
      byteCount: Int,
    ): RequestBody {
      checkOffsetAndCount(size.toLong(), offset.toLong(), byteCount.toLong())
      return object : RequestBody() {
        override fun contentType() = contentType
    
        override fun contentLength() = byteCount.toLong()
    
        override fun writeTo(sink: BufferedSink) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/ResponseBody.kt

        fun ByteString.toResponseBody(contentType: MediaType? = null): ResponseBody = commonToResponseBody(contentType)
    
        /** Returns a new response body that transmits this source. */
        @JvmStatic
        @JvmName("create")
        fun BufferedSource.asResponseBody(
          contentType: MediaType? = null,
          contentLength: Long = -1L,
        ): ResponseBody = commonAsResponseBody(contentType, contentLength)
    
        @JvmStatic
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/RequestTest.kt

        val contentType = "text/plain; charset=utf-16be".toMediaType()
        val body = "\u0800".toRequestBody(contentType)
        assertThat(body.contentType()).isEqualTo(contentType)
        assertThat(body.contentLength()).isEqualTo(2)
        assertThat(bodyToHex(body)).isEqualTo("0800")
      }
    
      @Test
      fun byteArray() {
        val contentType = "text/plain".toMediaType()
        val body: RequestBody = "abc".toByteArray().toRequestBody(contentType)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.4K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/http/BridgeInterceptor.kt

        val userRequest = chain.request()
        val requestBuilder = userRequest.newBuilder()
    
        val body = userRequest.body
        if (body != null) {
          val contentType = body.contentType()
          if (contentType != null) {
            requestBuilder.header("Content-Type", contentType.toString())
          }
    
          val contentLength = body.contentLength()
          if (contentLength != -1L) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  5. src/test/java/org/codelibs/core/net/MimeTypeUtilTest.java

            final String contentType = MimeTypeUtil.guessContentType(path);
            assertEquals("text/html", contentType);
        }
    
        /**
         * @throws Exception
         */
        @Test
        public void testGetFromStream_gif() throws Exception {
            final String path = ClassUtil.getPackageName(this.getClass()).replaceAll("\\.", "/") + "/ccc.gif";
            final String contentType = MimeTypeUtil.guessContentType(path);
    Java
    - Registered: Fri May 03 20:58:11 GMT 2024
    - Last Modified: Thu Mar 07 01:59:08 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  6. okcurl/src/test/kotlin/okhttp3/curl/MainTest.kt

        val body = request.body
        assertThat(request.method).isEqualTo("POST")
        assertThat(request.url.toString()).isEqualTo("http://example.com/")
        assertThat(body!!.contentType().toString()).isEqualTo(
          "application/x-www-form-urlencoded; charset=utf-8",
        )
        assertThat(bodyAsString(body)).isEqualTo("foo")
      }
    
      @Test
      fun dataPut() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  7. okhttp-testing-support/src/main/kotlin/okhttp3/ForwardingResponseBody.kt

    open class ForwardingResponseBody(delegate: ResponseBody?) : ResponseBody() {
      private val delegate: ResponseBody
    
      fun delegate(): ResponseBody {
        return delegate
      }
    
      override fun contentType(): MediaType? {
        return delegate.contentType()
      }
    
      override fun contentLength(): Long {
        return delegate.contentLength()
      }
    
      override fun source(): BufferedSource {
        return delegate.source()
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  8. okhttp-testing-support/src/main/kotlin/okhttp3/ForwardingRequestBody.kt

    open class ForwardingRequestBody(delegate: RequestBody?) : RequestBody() {
      private val delegate: RequestBody
    
      fun delegate(): RequestBody {
        return delegate
      }
    
      override fun contentType(): MediaType? {
        return delegate.contentType()
      }
    
      @Throws(IOException::class)
      override fun contentLength(): Long {
        return delegate.contentLength()
      }
    
      @Throws(IOException::class)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

      }
    
      @Test
      fun stringClosesUnderlyingSource() {
        val closed = AtomicBoolean()
        val body: ResponseBody =
          object : ResponseBody() {
            override fun contentType(): MediaType? {
              return null
            }
    
            override fun contentLength(): Long {
              return 5
            }
    
            override fun source(): BufferedSource {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/internal/-ResponseBodyCommon.kt

    internal fun ByteArray.commonToResponseBody(contentType: MediaType?): ResponseBody {
      return Buffer()
        .write(this)
        .asResponseBody(contentType, size.toLong())
    }
    
    internal fun ByteString.commonToResponseBody(contentType: MediaType?): ResponseBody {
      return Buffer()
        .write(this)
        .asResponseBody(contentType, size.toLong())
    }
    
    internal fun BufferedSource.commonAsResponseBody(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.3K bytes
    - Viewed (0)
Back to top