Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for toRequestBody (0.14 sec)

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

        @JvmStatic
        @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")
    Registered: 2024-06-16 04:42
    - Last Modified: 2024-01-25 14:41
    - 9.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/RequestBodyTest.kt

        assertOnFileDescriptor { fd ->
          val requestBody = fd.toRequestBody()
    
          assertThat(requestBody.contentLength()).isEqualTo(-1L)
          assertThat(requestBody.isOneShot()).isEqualTo(true)
        }
      }
    
      @Test
      fun testFileDescriptorRead() {
        assertOnFileDescriptor(content = "Hello") { fd ->
          val requestBody = fd.toRequestBody()
    
          val buffer = Buffer()
          requestBody.writeTo(buffer)
    Registered: 2024-06-16 04:42
    - Last Modified: 2024-01-08 01:13
    - 3.6K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/kt/PostString.kt

    import java.io.IOException
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.RequestBody.Companion.toRequestBody
    
    class PostString {
      private val client = OkHttpClient()
    
      fun run() {
        val postBody =
          """
          |Releases
          |--------
          |
          | * _1.0_ May 6, 2013
    Registered: 2024-06-16 04:42
    - Last Modified: 2024-01-08 01:13
    - 1.6K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/CommonRequestBodyTest.kt

    package okhttp3
    
    import assertk.assertThat
    import assertk.assertions.isEqualTo
    import kotlin.test.Test
    import okhttp3.RequestBody.Companion.toRequestBody
    
    class CommonRequestBodyTest {
      @Test
      fun correctContentType() {
        val body = "Body"
        val requestBody = body.toRequestBody(MediaType("text/plain", "text", "plain", arrayOf()))
    
        val contentType = requestBody.contentType()!!
    
    Registered: 2024-06-16 04:42
    - Last Modified: 2023-12-20 23:27
    - 1.1K bytes
    - Viewed (0)
  5. okcurl/src/main/kotlin/okhttp3/curl/internal/-MainCommon.kt

    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
    
    internal fun Main.commonCreateRequest(): Request {
      val request = Request.Builder()
    
    Registered: 2024-06-16 04:42
    - Last Modified: 2024-01-08 01:13
    - 2.7K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/CallKotlinTest.kt

    import mockwebserver3.SocketPolicy.ShutdownOutputAtEnd
    import okhttp3.Headers.Companion.headersOf
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.RequestBody.Companion.toRequestBody
    import okhttp3.TestUtil.assertSuppressed
    import okhttp3.internal.DoubleInetAddressDns
    import okhttp3.internal.connection.RealConnection
    import okhttp3.internal.connection.RealConnection.Companion.IDLE_CONNECTION_HEALTHY_NS
    Registered: 2024-06-16 04:42
    - Last Modified: 2024-01-20 10:30
    - 8.4K bytes
    - Viewed (0)
Back to top