Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for peekTrailers (0.07 sec)

  1. okhttp/src/jvmTest/kotlin/okhttp3/TrailersTest.kt

        assertThat(response.trailers()).isEqualTo(headersOf("t1", "v1"))
      }
    
      @Test
      fun peekTrailersHttp1() {
        peekTrailers(Protocol.HTTP_1_1)
      }
    
      @Test
      fun peekTrailersHttp2() {
        peekTrailers(Protocol.HTTP_2)
      }
    
      private fun peekTrailers(protocol: Protocol) {
        val responseBody = "a".repeat(OKHTTP_CLIENT_WINDOW_SIZE)
        enableProtocol(protocol)
    
        server.enqueue(
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 18:57:05 UTC 2025
    - 18K bytes
    - Viewed (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http2/Http2ExchangeCodec.kt

          !response.promisesBody() -> 0L
          else -> response.headersContentLength()
        }
    
      override fun openResponseBodySource(response: Response): Source = stream!!.source
    
      override fun peekTrailers(): Headers? = stream!!.peekTrailers()
    
      override fun cancel() {
        canceled = true
        stream?.closeLater(ErrorCode.CANCEL)
      }
    
      companion object {
        private const val CONNECTION = "connection"
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 21:11:09 UTC 2025
    - 7K bytes
    - Viewed (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/Exchange.kt

        } catch (e: IOException) {
          eventListener.responseFailed(call, e)
          trackFailure(e)
          throw e
        }
      }
    
      @Throws(IOException::class)
      fun peekTrailers(): Headers? = codec.peekTrailers()
    
      fun upgradeToSocket(): Socket {
        call.timeoutEarlyExit()
        (codec.carrier as RealConnection).useAsSocket()
    
        eventListener.requestBodyStart(call)
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 22:04:11 UTC 2025
    - 9.7K bytes
    - Viewed (0)
  4. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/ExchangeCodec.kt

      @Throws(IOException::class)
      fun openResponseBodySource(response: Response): Source
    
      /** Returns the trailers after the HTTP response if they're ready. May be empty. */
      @Throws(IOException::class)
      fun peekTrailers(): Headers?
    
      /**
       * Cancel this stream. Resources held by this stream will be cleaned up, though not synchronously.
       * That may happen later by the connection pool thread.
       */
      fun cancel()
    
      /**
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 21:11:09 UTC 2025
    - 3.3K bytes
    - Viewed (0)
  5. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/CallServerInterceptor.kt

                response
                  .newBuilder()
                  .body(responseBody)
                  .trailers(
                    object : TrailersSource {
                      override fun peek() = exchange.peekTrailers()
    
                      override fun get(): Headers {
                        val source = responseBody.source()
                        if (source.isOpen) {
                          source.skipAll()
                        }
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 29 22:04:11 UTC 2025
    - 7.8K bytes
    - Viewed (0)
  6. okhttp/src/jvmTest/kotlin/okhttp3/internal/http2/Http2ConnectionTest.kt

        val stream = connection.newStream(headerEntries("a", "artichaut"), false)
        connection.writePingAndAwaitPong()
        assertThat(stream.takeHeaders()).isEqualTo(headersOf("headers", "bam"))
        assertThat(stream.peekTrailers()).isEqualTo(Headers.EMPTY)
        assertThat(connection.openStreamCount()).isEqualTo(0)
    
        // Verify the peer received what was expected.
        val synStream = peer.takeFrame()
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jul 31 04:18:40 UTC 2025
    - 75.5K bytes
    - Viewed (0)
  7. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http1/Http1ExchangeCodec.kt

              newFixedLengthSource(response.request.url, contentLength)
            } else {
              newUnknownLengthSource(response.request.url)
            }
          }
        }
    
      override fun peekTrailers(): Headers? {
        if (trailers === TRAILERS_RESPONSE_BODY_TRUNCATED) {
          throw IOException("Trailers cannot be read because the response body was truncated")
        }
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jul 31 04:18:40 UTC 2025
    - 17.5K bytes
    - Viewed (0)
  8. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Response.kt

       *
       * @throws IOException if the trailers cannot be loaded, such as if the network connection is
       *     dropped.
       */
      @Throws(IOException::class)
      fun peekTrailers(): Headers? = trailersSource.peek()
    
      /**
       * Peeks up to [byteCount] bytes from the response body and returns them as a new response
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 28 14:39:28 UTC 2025
    - 18.1K bytes
    - Viewed (0)
  9. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http2/Http2Stream.kt

          }
          throw errorException ?: StreamResetException(errorCode!!)
        }
      }
    
      /**
       * Returns the trailers if they're immediately available.
       */
      @Throws(IOException::class)
      fun peekTrailers(): Headers? {
        withLock {
          if (source.finished && source.receiveBuffer.exhausted() && source.readBuffer.exhausted()) {
            return source.trailers ?: Headers.EMPTY
          }
          if (errorCode != null) {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 18:57:05 UTC 2025
    - 22.4K bytes
    - Viewed (0)
  10. CHANGELOG.md

    Change Log
    ==========
    
    ## Version 4.x
    
    See [4.x Change log](https://square.github.io/okhttp/changelogs/changelog_4x/) for the stable version changelogs.
    
    ## Version 5.1.0
    
    _2025-07-07_
    
     *  New: `Response.peekTrailers()`. When we changed `Response.trailers()` to block instead of
        throwing in 5.0.0, we inadvertently removed the ability for callers to peek the trailers
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 19:32:33 UTC 2025
    - 31.6K bytes
    - Viewed (1)
Back to top