Sourced from com.squareup.okhttp3:okhttp's changelog.
Version 5.1.0
2025-07-07
New:
Response.peekTrailers(). When we changedResponse.trailers()to block instead of throwing in 5.0.0, we inadvertently removed the ability for callers to peek the trailers (by catching theIllegalStateExceptionif they weren't available). This new API restores that capability.Fix: Don't crash on
trailers()if the response doesn't have a body. We broke [Retrofit] users who read the trailers on theraw()OkHttp response, after its body was decoded.Version 5.0.0
2025-07-02
This is our first stable release of OkHttp since 2023. Here's the highlights if you're upgrading from OkHttp 4.x:
OkHttp is now packaged as separate JVM and Android artifacts. This allows us to offer platform-specific features and optimizations. If your build system handles [Gradle module metadata], this change should be automatic.
MockWebServer has a new coordinate and package name. We didn’t like that our old artifact depends on JUnit 4 so the new one doesn’t. It also has a better API built on immutable values. (We intend to continue publishing the old
okhttp3.mockwebserverartifact so there’s no urgency to migrate.)
Coordinate Package Name Description com.squareup.okhttp3:mockwebserver3:5.0.0 mockwebserver3 Core module. No JUnit dependency! com.squareup.okhttp3:mockwebserver3-junit4:5.0.0 mockwebserver3.junit4 Optional JUnit 4 integration. com.squareup.okhttp3:mockwebserver3-junit5:5.0.0 mockwebserver3.junit5 Optional JUnit 5 integration. com.squareup.okhttp3:mockwebserver:5.0.0 okhttp3.mockwebserver Obsolete. Depends on JUnit 4. OkHttp now supports Happy Eyeballs ([RFC 8305][rfc_8305]) for IPv4+IPv6 networks. It attempts both IPv6 and IPv4 connections concurrently, keeping whichever connects first.
We’ve improved our Kotlin APIs. You can skip the builder:
val request = Request( url = "https://cash.app/".toHttpUrl(), )OkHttp now supports [GraalVM].
Here’s what has changed since 5.0.0-alpha.17:
... (truncated)
d2dd180
Prepare for release 5.1.0.61a8735
New Response.peekTrailers() API (#8921)6684401
Update dependency gradle to v8.14.3 (#8915)7adb2b6
Update junit-framework monorepo (#8914)e41ff18
Link to new mockwebserver artifacts (#8911)0ff8751
Remove Graal init tracing (#8909)b9a2560
Run graal on master (#8907)8339524
Remove ExperimentalOkHttpApi references (#8908)ce29ef6
Fix graal tests (#8906)8579689
Don't force a response body read on all trailers (#8904)Sourced from com.squareup.okhttp3:logging-interceptor's changelog.
Version 5.1.0
2025-07-07
New:
Response.peekTrailers(). When we changedResponse.trailers()to block instead of throwing in 5.0.0, we inadvertently removed the ability for callers to peek the trailers (by catching theIllegalStateExceptionif they weren't available). This new API restores that capability.Fix: Don't crash on
trailers()if the response doesn't have a body. We broke [Retrofit] users who read the trailers on theraw()OkHttp response, after its body was decoded.Version 5.0.0
2025-07-02
This is our first stable release of OkHttp since 2023. Here's the highlights if you're upgrading from OkHttp 4.x:
OkHttp is now packaged as separate JVM and Android artifacts. This allows us to offer platform-specific features and optimizations. If your build system handles [Gradle module metadata], this change should be automatic.
MockWebServer has a new coordinate and package name. We didn’t like that our old artifact depends on JUnit 4 so the new one doesn’t. It also has a better API built on immutable values. (We intend to continue publishing the old
okhttp3.mockwebserverartifact so there’s no urgency to migrate.)
Coordinate Package Name Description com.squareup.okhttp3:mockwebserver3:5.0.0 mockwebserver3 Core module. No JUnit dependency! com.squareup.okhttp3:mockwebserver3-junit4:5.0.0 mockwebserver3.junit4 Optional JUnit 4 integration. com.squareup.okhttp3:mockwebserver3-junit5:5.0.0 mockwebserver3.junit5 Optional JUnit 5 integration. com.squareup.okhttp3:mockwebserver:5.0.0 okhttp3.mockwebserver Obsolete. Depends on JUnit 4. OkHttp now supports Happy Eyeballs ([RFC 8305][rfc_8305]) for IPv4+IPv6 networks. It attempts both IPv6 and IPv4 connections concurrently, keeping whichever connects first.
We’ve improved our Kotlin APIs. You can skip the builder:
val request = Request( url = "https://cash.app/".toHttpUrl(), )OkHttp now supports [GraalVM].
Here’s what has changed since 5.0.0-alpha.17:
... (truncated)
d2dd180
Prepare for release 5.1.0.61a8735
New Response.peekTrailers() API (#8921)6684401
Update dependency gradle to v8.14.3 (#8915)7adb2b6
Update junit-framework monorepo (#8914)e41ff18
Link to new mockwebserver artifacts (#8911)0ff8751
Remove Graal init tracing (#8909)b9a2560
Run graal on master (#8907)8339524
Remove ExperimentalOkHttpApi references (#8908)ce29ef6
Fix graal tests (#8906)8579689
Don't force a response body read on all trailers (#8904)