Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 66 for RequestBody (0.28 sec)

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

          offset: Int = 0,
          byteCount: Int = size,
        ): RequestBody = commonToRequestBody(contentType, offset, byteCount)
    
        /** Returns a new request body that transmits the content of this. */
        @JvmStatic
        @JvmName("create")
        fun File.asRequestBody(contentType: MediaType? = null): RequestBody {
          return object : RequestBody() {
            override fun contentType() = contentType
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Jan 25 14:41:37 GMT 2024
    - 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)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  3. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

          val requestBody = request.body
    
          val connection = chain.connection()
          var requestStartMessage =
            ("--> ${request.method} ${redactUrl(request.url)}${if (connection != null) " " + connection.protocol() else ""}")
          if (!logHeaders && requestBody != null) {
            requestStartMessage += " (${requestBody.contentLength()}-byte body)"
          }
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  4. okhttp/src/main/kotlin/okhttp3/internal/http/CallServerInterceptor.kt

        val request = realChain.request
        val requestBody = request.body
        val sentRequestMillis = System.currentTimeMillis()
    
        var invokeStartEvent = true
        var responseBuilder: Response.Builder? = null
        var sendRequestException: IOException? = null
        try {
          exchange.writeRequestHeaders(request)
    
          if (HttpMethod.permitsRequestBody(request.method) && requestBody != null) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 6.3K bytes
    - Viewed (1)
  5. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

      @Test
      fun multipartBodyPart() {
        val requestBody: RequestBody = "".toRequestBody(null)
        var part: MultipartBody.Part = MultipartBody.Part.create(null, requestBody)
        part = MultipartBody.Part.create(headersOf(), requestBody)
        part = MultipartBody.Part.create(requestBody)
        part = MultipartBody.Part.createFormData("", "")
        part = MultipartBody.Part.createFormData("", "", requestBody)
    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)
  6. okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt

          ),
        )
    
        val requestBody = AsyncRequestBody()
    
        val call =
          client.newCall(
            Request(
              url = server.url("/"),
              body = requestBody,
            ),
          )
    
        call.execute().use { response ->
          assertThat(response.body.string()).isEqualTo("abc")
          val requestBodyOut = requestBody.takeSink()
          assertFailsWith<IOException> {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  7. okhttp/src/main/kotlin/okhttp3/internal/-RequestCommon.kt

    fun Request.Builder.commonPost(body: RequestBody): Request.Builder = method("POST", body)
    
    fun Request.Builder.commonDelete(body: RequestBody?): Request.Builder = method("DELETE", body)
    
    fun Request.Builder.commonPut(body: RequestBody): Request.Builder = method("PUT", body)
    
    fun Request.Builder.commonPatch(body: RequestBody): Request.Builder = method("PATCH", body)
    
    fun Request.Builder.commonMethod(
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/internal/http/RetryAndFollowUpInterceptor.kt

        return true
      }
    
      private fun requestIsOneShot(
        e: IOException,
        userRequest: Request,
      ): Boolean {
        val requestBody = userRequest.body
        return (requestBody != null && requestBody.isOneShot()) ||
          e is FileNotFoundException
      }
    
      private fun isRecoverable(
        e: IOException,
        requestSendStarted: Boolean,
      ): Boolean {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 12.1K bytes
    - Viewed (4)
  9. okhttp/src/test/java/okhttp3/DuplexTest.kt

          )
        call.execute().use { response ->
          val requestBody = (call.request().body as AsyncRequestBody?)!!.takeSink()
          requestBody.writeUtf8("request A\n")
          requestBody.flush()
          val responseBody = response.body.source()
          assertThat(responseBody.readUtf8Line())
            .isEqualTo("response B")
          requestBody.writeUtf8("request C\n")
          requestBody.flush()
          assertThat(responseBody.readUtf8Line())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/Request.kt

        open fun head(): Builder = commonHead()
    
        open fun post(body: RequestBody): Builder = commonPost(body)
    
        @JvmOverloads
        open fun delete(body: RequestBody? = commonEmptyRequestBody): Builder = commonDelete(body)
    
        open fun put(body: RequestBody): Builder = commonPut(body)
    
        open fun patch(body: RequestBody): Builder = commonPatch(body)
    
        open fun method(
          method: String,
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:17:44 GMT 2024
    - 10.5K bytes
    - Viewed (0)
Back to top