diff --git a/CHANGELOG.md b/CHANGELOG.md index 33e5df704..9f704cd63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ Change Log 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 + (by catching the `IllegalStateException` if 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 the `raw()` OkHttp response, after its body was decoded. + + ## Version 5.0.0 _2025-07-02_ @@ -630,6 +643,7 @@ release is the version name. [GraalVM]: https://www.graalvm.org/ [Gradle module metadata]: https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html [Ktor]: https://ktor.io/ +[Retrofit]: https://square.github.io/retrofit/ [annotation_1_9_1]: https://developer.android.com/jetpack/androidx/releases/annotation#annotation-1.9.1 [assertk]: https://github.com/willowtreeapps/assertk [coroutines_1_10_2]: https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.10.2 diff --git a/README.md b/README.md index 5fe10ee83..720d56f6e 100644 --- a/README.md +++ b/README.md @@ -120,10 +120,10 @@ Releases Our [change log][changelog] has release history. -The latest release is available on [Maven Central](https://search.maven.org/artifact/com.squareup.okhttp3/okhttp/5.0.0/jar). +The latest release is available on [Maven Central](https://search.maven.org/artifact/com.squareup.okhttp3/okhttp/5.1.0/jar). ```kotlin -implementation("com.squareup.okhttp3:okhttp:5.0.0") +implementation("com.squareup.okhttp3:okhttp:5.1.0") ``` Snapshot builds are [available][snap]. [R8 and ProGuard][r8_proguard] rules are available. @@ -133,7 +133,7 @@ Also, we have a [bill of materials (BOM)][bom] available to help you keep OkHttp ```kotlin dependencies { // define a BOM and its version - implementation(platform("com.squareup.okhttp3:okhttp-bom:5.0.0")) + implementation(platform("com.squareup.okhttp3:okhttp-bom:5.1.0")) // define any required OkHttp artifacts without version implementation("com.squareup.okhttp3:okhttp") @@ -146,10 +146,10 @@ MockWebServer OkHttp includes a library for testing HTTP, HTTPS, and HTTP/2 clients. -The latest release is available on [Maven Central](https://search.maven.org/artifact/com.squareup.okhttp3/mockwebserver/5.0.0/jar). +The latest release is available on [Maven Central](https://search.maven.org/artifact/com.squareup.okhttp3/mockwebserver/5.1.0/jar). ```kotlin -testImplementation("com.squareup.okhttp3:mockwebserver3:5.0.0") +testImplementation("com.squareup.okhttp3:mockwebserver3:5.1.0") ``` MockWebServer is used for firstly for internal testing, and for basic testing of apps using OkHttp client. diff --git a/build.gradle.kts b/build.gradle.kts index d2b269ab4..446e37893 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ configure { allprojects { group = "com.squareup.okhttp3" - version = "5.1.0-SNAPSHOT" + version = "5.1.0" repositories { mavenCentral() diff --git a/mockwebserver-junit4/README.md b/mockwebserver-junit4/README.md index ebac78293..459e54980 100644 --- a/mockwebserver-junit4/README.md +++ b/mockwebserver-junit4/README.md @@ -6,7 +6,7 @@ This module integrates mockwebserver3.MockWebServer with JUnit 4. To use, first add this library as a test dependency: ``` -testImplementation("com.squareup.okhttp3:mockwebserver3-junit4:5.0.0") +testImplementation("com.squareup.okhttp3:mockwebserver3-junit4:5.1.0") ``` Then in tests annotated `@org.junit.Test`, you may declare a field with the `@Rule` annotation: diff --git a/mockwebserver-junit5/README.md b/mockwebserver-junit5/README.md index 91f6423bb..acbcf41da 100644 --- a/mockwebserver-junit5/README.md +++ b/mockwebserver-junit5/README.md @@ -6,7 +6,7 @@ This module integrates mockwebserver3.MockWebServer with JUnit 5. To use, first add this library as a test dependency: ``` -testImplementation("com.squareup.okhttp3:mockwebserver3-junit5:5.0.0") +testImplementation("com.squareup.okhttp3:mockwebserver3-junit5:5.1.0") ``` Annotate fields in test classes with `@StartStop`. The server will be started and shut down diff --git a/mockwebserver/README.md b/mockwebserver/README.md index 65ada6331..0c22af6ca 100644 --- a/mockwebserver/README.md +++ b/mockwebserver/README.md @@ -142,7 +142,7 @@ server.setDispatcher(dispatcher); ### Download ```kotlin -testImplementation("com.squareup.okhttp3:mockwebserver3:5.0.0") +testImplementation("com.squareup.okhttp3:mockwebserver3:5.1.0") ``` ### License diff --git a/okhttp-brotli/README.md b/okhttp-brotli/README.md index cb59ce110..6d3709097 100644 --- a/okhttp-brotli/README.md +++ b/okhttp-brotli/README.md @@ -14,7 +14,7 @@ OkHttpClient client = new OkHttpClient.Builder() ``` ```kotlin -implementation("com.squareup.okhttp3:okhttp-brotli:5.0.0") +implementation("com.squareup.okhttp3:okhttp-brotli:5.1.0") ``` [1]: https://github.com/google/brotli diff --git a/okhttp-dnsoverhttps/README.md b/okhttp-dnsoverhttps/README.md index 22811901a..9141b206e 100644 --- a/okhttp-dnsoverhttps/README.md +++ b/okhttp-dnsoverhttps/README.md @@ -6,7 +6,7 @@ This module is an implementation of [DNS over HTTPS][1] using OkHttp. ### Download ```kotlin -testImplementation("com.squareup.okhttp3:okhttp-dnsoverhttps:5.0.0") +testImplementation("com.squareup.okhttp3:okhttp-dnsoverhttps:5.1.0") ``` ### Usage diff --git a/okhttp-java-net-cookiejar/README.md b/okhttp-java-net-cookiejar/README.md index e52dce46c..4072f76f1 100644 --- a/okhttp-java-net-cookiejar/README.md +++ b/okhttp-java-net-cookiejar/README.md @@ -7,5 +7,5 @@ This used to be part of `okhttp-urlconnection` ### Download ```kotlin -testImplementation("com.squareup.okhttp3:okhttp-java-net-cookiehandler:5.0.0") +testImplementation("com.squareup.okhttp3:okhttp-java-net-cookiehandler:5.1.0") ``` diff --git a/okhttp-logging-interceptor/README.md b/okhttp-logging-interceptor/README.md index 499256047..38b4dbd3b 100644 --- a/okhttp-logging-interceptor/README.md +++ b/okhttp-logging-interceptor/README.md @@ -37,7 +37,7 @@ Download -------- ```kotlin -implementation("com.squareup.okhttp3:logging-interceptor:5.0.0") +implementation("com.squareup.okhttp3:logging-interceptor:5.1.0") ``` diff --git a/okhttp-sse/README.md b/okhttp-sse/README.md index de37abe1a..8e1567584 100644 --- a/okhttp-sse/README.md +++ b/okhttp-sse/README.md @@ -7,5 +7,5 @@ API is not considered stable and may change at any time. ### Download ```kotlin -testImplementation("com.squareup.okhttp3:okhttp-sse:5.0.0") +testImplementation("com.squareup.okhttp3:okhttp-sse:5.1.0") ``` diff --git a/okhttp-tls/README.md b/okhttp-tls/README.md index 25f189b4e..42b039372 100644 --- a/okhttp-tls/README.md +++ b/okhttp-tls/README.md @@ -225,7 +225,7 @@ Download -------- ```kotlin -implementation("com.squareup.okhttp3:okhttp-tls:5.0.0") +implementation("com.squareup.okhttp3:okhttp-tls:5.1.0") ``` [held_certificate]: https://square.github.io/okhttp/4.x/okhttp-tls/okhttp3.tls/-held-certificate/ diff --git a/okhttp-urlconnection/README.md b/okhttp-urlconnection/README.md index 1c7192e41..31a642df7 100644 --- a/okhttp-urlconnection/README.md +++ b/okhttp-urlconnection/README.md @@ -8,5 +8,5 @@ This module is obsolete; prefer `okhttp-java-net-cookiejar`. ### Download ```kotlin -testImplementation("com.squareup.okhttp3:okhttp-urlconnection:5.0.0") +testImplementation("com.squareup.okhttp3:okhttp-urlconnection:5.1.0") ```