Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for asRequestBody (0.18 sec)

  1. okhttp/src/test/java/okhttp3/RequestTest.kt

    import java.util.UUID
    import kotlin.test.assertFailsWith
    import okhttp3.Headers.Companion.headersOf
    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.MediaType.Companion.toMediaType
    import okhttp3.RequestBody.Companion.asRequestBody
    import okhttp3.RequestBody.Companion.toRequestBody
    import okio.Buffer
    import okio.ByteString.Companion.encodeUtf8
    import org.junit.jupiter.api.Test
    
    class RequestTest {
      @Test
      fun constructor() {
    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)
  2. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

        requestBody = byteArrayOf(0, 1).toRequestBody(null, 0, 2)
        requestBody = byteArrayOf(0, 1).toRequestBody("".toMediaTypeOrNull(), 0, 2)
        requestBody = File("").asRequestBody(null)
        requestBody = File("").asRequestBody("".toMediaTypeOrNull())
      }
    
      @Test
      fun response() {
        val response: Response = Response.Builder().build()
        val request: Request = response.request
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 46.5K bytes
    - Viewed (4)
  3. docs/changelogs/upgrading_to_okhttp_4.md

    | RequestBody.create(ByteArray)       | ByteArray.toRequestBody()       |
    | RequestBody.create(ByteString)      | ByteString.toRequestBody()      |
    | RequestBody.create(File)            | File.asRequestBody()            |
    | RequestBody.create(String)          | String.toRequestBody()          |
    | ResponseBody.create(BufferedSource) | BufferedSource.asResponseBody() |
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 16:58:16 GMT 2022
    - 10.9K bytes
    - Viewed (0)
  4. docs/recipes.md

          fun run() {
            val file = File("README.md")
    
            val request = Request.Builder()
                .url("https://api.github.com/markdown/raw")
                .post(file.asRequestBody(MEDIA_TYPE_MARKDOWN))
                .build()
    
            client.newCall(request).execute().use { response ->
              if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Feb 18 08:52:22 GMT 2022
    - 40.2K bytes
    - Viewed (1)
  5. docs/changelogs/changelog_4x.md

        import this and we want to ease upgrades for their users.
    
    
    ## Version 4.0.0-RC2
    
    _2019-06-21_
    
     *  New: Require Kotlin 1.3.40.
     *  New: Change the Kotlin API from `File.toRequestBody()` to `File.asRequestBody()` and
        `BufferedSource.toResponseBody()` to `BufferedSource.asResponseBody()`. If the returned value
        is a view of what created it, we use _as_.
     *  Fix: Permit response codes of zero for compatibility with OkHttp 3.x.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 17 13:25:31 GMT 2024
    - 25.2K bytes
    - Viewed (0)
Back to top