Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 48 for content_length (0.16 sec)

  1. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

            throw e
          }
    
          val tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
    
          val responseBody = response.body!!
          val contentLength = responseBody.contentLength()
          val bodySize = if (contentLength != -1L) "$contentLength-byte" else "unknown-length"
          logger.log(
            buildString {
              append("<-- ${response.code}")
    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)
  2. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

        val closed = AtomicBoolean()
        val body: ResponseBody =
          object : ResponseBody() {
            override fun contentType(): MediaType? {
              return null
            }
    
            override fun contentLength(): Long {
              return 5
            }
    
            override fun source(): BufferedSource {
              val source = Buffer().writeUtf8("hello")
              return object : ForwardingSource(source) {
    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)
  3. okhttp/src/main/kotlin/okhttp3/internal/http/RealResponseBody.kt

       * by malformed content types.
       */
      private val contentTypeString: String?,
      private val contentLength: Long,
      private val source: BufferedSource,
    ) : ResponseBody() {
      override fun contentLength(): Long = contentLength
    
      override fun contentType(): MediaType? = contentTypeString?.toMediaTypeOrNull()
    
      override fun source(): BufferedSource = 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)
  4. okhttp/src/test/java/okhttp3/RequestBodyTest.kt

      ) {
        filePath = tempDir.toOkioPath() / "file.txt"
      }
    
      @Test
      fun testFileDescriptor() {
        assertOnFileDescriptor { fd ->
          val requestBody = fd.toRequestBody()
    
          assertThat(requestBody.contentLength()).isEqualTo(-1L)
          assertThat(requestBody.isOneShot()).isEqualTo(true)
        }
      }
    
      @Test
      fun testFileDescriptorRead() {
        assertOnFileDescriptor(content = "Hello") { fd ->
    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)
  5. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

        server.enqueue(MockResponse())
        val contentLength = Int.MAX_VALUE + 1L
        val response =
          getResponse(
            Request(
              url = server.url("/"),
              body =
                object : RequestBody() {
                  override fun contentType(): MediaType? = null
    
                  override fun contentLength(): Long = contentLength
    
                  override fun writeTo(sink: BufferedSink) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 131.7K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/internal/http1/Http1ExchangeCodec.kt

          !response.promisesBody() -> newFixedLengthSource(0)
          response.isChunked -> newChunkedSource(response.request.url)
          else -> {
            val contentLength = response.headersContentLength()
            if (contentLength != -1L) {
              newFixedLengthSource(contentLength)
            } else {
              newUnknownLengthSource()
            }
          }
        }
      }
    
      override fun trailers(): Headers {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.2K bytes
    - Viewed (0)
  7. okhttp/src/main/kotlin/okhttp3/Cache.kt

          val contentLength = responseHeaders["Content-Length"]
          val cacheRequest = Request(url, varyHeaders, requestMethod)
          return Response.Builder()
            .request(cacheRequest)
            .protocol(protocol)
            .code(code)
            .message(message)
            .headers(responseHeaders)
            .body(CacheResponseBody(snapshot, contentType, contentLength))
            .handshake(handshake)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 26.8K bytes
    - Viewed (0)
  8. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

            headers.removeAll(name)
          }
    
        fun body(body: Buffer) = body(body.toMockResponseBody())
    
        fun body(body: MockResponseBody) =
          apply {
            setHeader("Content-Length", body.contentLength)
            this.body = body
          }
    
        /** Sets the response body to the UTF-8 encoded bytes of [body]. */
        fun body(body: String): Builder = body(Buffer().writeUtf8(body))
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 13.3K bytes
    - Viewed (1)
  9. okhttp/src/test/java/okhttp3/MultipartBodyTest.kt

        assertThat(body.contentType().toString())
          .isEqualTo("multipart/mixed; boundary=123")
        assertThat(body.parts.size).isEqualTo(1)
        assertThat(body.contentLength()).isEqualTo(33L)
        val buffer = Buffer()
        body.writeTo(buffer)
        assertThat(body.contentLength()).isEqualTo(buffer.size)
        assertThat(buffer.readUtf8()).isEqualTo(expected)
      }
    
      @Test
      fun threeParts() {
        val expected =
          """
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/ResponseBody.kt

              expression = "content.asResponseBody(contentType, contentLength)",
              imports = ["okhttp3.ResponseBody.Companion.asResponseBody"],
            ),
          level = DeprecationLevel.WARNING,
        )
        fun create(
          contentType: MediaType?,
          contentLength: Long,
          content: BufferedSource,
        ): ResponseBody = content.asResponseBody(contentType, contentLength)
      }
    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)
Back to top