1
0
mirror of https://github.com/square/okhttp.git synced 2025-07-03 02:42:27 +03:00

245 Commits

Author SHA1 Message Date
f745695087 Replace SocketPolicy with a new type, SocketEffect (#8870)
* Replace SocketPolicy with a new type, SocketEffect

SocketPolicy encapsulated two things:
 - a trigger (request start, response body, etc)
 - an effect (close the socket, close the stream, stall, etc.)

It also had some special cases for effects like
failing the TLS handshake.

With this PR there's a new class, SocketEffect, that determines
what to do. It's assigned to one of 5 fields for different
triggers.

# Conflicts:
#	mockwebserver/src/main/kotlin/mockwebserver3/MockWebServer.kt

* apiDump

* Track API change

* Track more API changes

* Spotless

---------

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-06-20 07:46:46 -04:00
5f3ec584f7 Switch to @StartStop for JUnit 5 tests (#8863)
* New @StartStop extension for JUnit 5

This is a new take on our JUnit 5 extension. Rather than creating and managing
the MockWebServer instance in the extension, we let the user create it and all
the extension does is manage the lifecycle.

Note that this annotation doesn't require any external configuration - it doesn't
need a system-property to opt-into 'automatic' extensions, and it doesn't require
a class-level extension either.

* apiDump

* Switch to @StartStop for JUnit 5 tests

* Fixup visibility

---------

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-06-18 08:28:21 -04:00
71a759f77e Move gzip() from RequestBody to Request.Builder (#8838)
On Request.Builder the one function can add the header
and apply compression. Otherwise the caller needs to
keep those calls in sync.

One severe drawback of this approach is the calls to
Request.Builder are now ordered. If you call gzip()
before you call post(), it'll crash. Worse, if you
call post() and then gzip() and then post() again
with a different body, it'll silently not compress
the new body. I don't love this drawback but I think
the mitigations aren't worth the effort.
2025-06-04 13:43:43 -04:00
27ddd2c286 Drop the findbugs dependency (#8769)
We don't need it.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-05-13 20:51:50 -04:00
262d7020f2 Cleanup github workflows add latest JDK (#8652)
* Cleanup github workflows add latest JDK

Co-authored-by: Jake Wharton <github@jakewharton.com>
2025-05-10 14:39:47 +01:00
f2640e0b08 Create a friends configuration to use internals. (#8651)
* Create a friends configuration to use internals.

From https://www.liutikas.net/2025/01/12/Kotlin-Library-Friends.html we should avoid using

@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")

So instead lets just be friends.
2025-05-10 12:15:14 +01:00
a51cfbf841 Update dependency com.diffplug.spotless:spotless-plugin-gradle to v7 (#8702)
* Update dependency com.diffplug.spotless:spotless-plugin-gradle to v7

* Reformat

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2025-03-19 15:25:20 -04:00
fb22f4973e Update to official GraalVM tooling (#8613) 2024-12-21 10:56:29 +02:00
b4614e466c Hide the value of sensitive query parameters in log (#8242)
Add option to redact sensitive query params.
2024-04-06 10:14:38 +01:00
3bed816c91 Add a configurable AndroidLogging API (#7844) 2024-04-01 12:07:32 +01:00
a16dcecfeb Allow constructor injection of MockWebServer (#8191) 2024-01-14 10:20:09 +00:00
a228fd64cc Reformat with Spotless (#8180)
* Enable spotless

* Run spotlessApply

* Fixup trimMargin

* Re-run spotlessApply
2024-01-07 20:13:22 -05:00
0e312d7804 Prepare to enable Spotless (#8179)
* Prepare to enable Spotless

I'm not super keen on any of these changes, but I am very
keen on having automatic formatting.

* Don't actually enable Spotless yet
2024-01-07 11:05:34 -05:00
eb6c016f6f Stop using AssertJ (#8174)
* Stop using AssertJ

This completes the migration to assertk.

* Fix a missing import

* Fix some type issues
2024-01-04 00:32:07 -05:00
cea704d954 Fix android test (#8157) 2023-12-24 05:30:24 +00:00
9724956cb4 Convert more tests from Java to Kotlin (#8155) 2023-12-23 10:26:25 +00:00
c056530682 Switch back to the kotlin JVM plugin (#8149)
* Switch back to the kotlin JVM plugin

This does a ton of file moves from jvmMain to main, and jvmTest to test.

* Don't use AnimalSniffer on okcurl

* Use assertk more (#8150)
2023-12-20 18:27:07 -05:00
c9f62b501a Advertise 4.12.0 in docs 2023-12-17 10:34:10 -05:00
95cb15ab4d Disable javadoc (#8025) 2023-09-16 10:38:35 +01:00
5d8e2d3731 Log total time of request when buffering body (#7966) 2023-08-14 17:45:20 +03:00
d03decd45a Kotlin 1.9 (#7952) 2023-07-22 13:28:51 +01:00
248b0e6318 Update Release version (#7792) 2023-05-01 11:27:57 +01:00
f408411ff9 Avoid exposing internal methods (#7734) 2023-04-23 08:05:59 +01:00
3ea6b81e5c Make SocketPolicy a sealed interface (#7610)
* Make SocketPolicy a sealed interface

* Dump APIs
2023-01-02 15:13:13 -05:00
fe6db78647 Get more TLS stuff passing on BouncyCastle (#7602)
There's something up with ECDSA on BouncyCastle, and rather
than figuring it out I've just switched to RSA signatures
with that provider.
2022-12-31 20:39:55 -05:00
fe15ccda5b Switch to a Builder for mockwebserver3.MockResponse (#7578)
* Switch to a Builder for mockwebserver3.MockResponse

* Migrate lots of tests to MockResponse.Builder

* Improve some code style

* Follow naming conventions in MockResponse.Builder

* Apply side-effects for inTunnel=true

* Update the API
2022-12-28 10:13:49 -05:00
02a56342fa Avoid logging SSE (#7555) 2022-12-19 05:23:07 +05:30
e9a3ad3d94 4.10.0 is out 2022-06-12 10:09:53 -04:00
afc7fa3700 Delete the unused tunnelProxy argument (#7317)
* Delete the unused tunnelProxy argument

* Update API spec
2022-06-09 13:14:05 -04:00
bdc213f180 Remove japicmp (#7118)
This plugin served us very well for a long time. But the binary
compatibility plugin is better suited for our current situation.
2022-02-27 10:20:06 -05:00
3e16ec28fe Adopt Kotlin's binary compatibility validator (#7112) 2022-02-26 14:17:33 -05:00
362f53546d Adopt Version Catalog and Updates plugin (#7075) 2022-02-15 23:38:32 +00:00
f5758b7f26 Enable Gradle's type-safe project accessors (#7069) 2022-02-08 20:01:28 +00:00
f15c81b4e9 HappyEyeballs (#7035)
This doesn't yet introduce any mechanism to enable or disable
happy eyeballs.

It also doesn't sort IP addresses to alternate IPv6, IPv4
for best success.

It also doesn't limit how many connections are attempted
simultaneously.

It also lacks an appropriate number of tests.
2022-01-28 11:11:05 -05:00
b97eeacaa3 Log gzip request body size (#7013) 2022-01-17 08:15:43 +00:00
34d5cba5a8 Remove redundant UTF_8 params (#6994)
* Remove redundant UTF_8 params

* Simplify ByteArray to String

* Add MediaType?.charset
2022-01-09 00:25:31 -05:00
5cfc040daf Replace StandardCharsets with Charsets in Kotlin (#6986) 2022-01-08 16:17:43 +00:00
8debc78b00 Simplify gradle kts (#6931) 2021-11-27 12:31:27 +00:00
d9a65a85c5 Switch to Vanniktech for Maven publishing (#6929)
* Switch to Vanniktech for Maven publishing

Steal configuration from Okio, which already works nicely.

* Update mockwebserver-junit5/build.gradle.kts

Co-authored-by: Benoît Quenaudon <bquenaudon@squareup.com>

Co-authored-by: Benoît Quenaudon <bquenaudon@squareup.com>
2021-11-26 06:58:00 -05:00
d0759a7907 Simplify kts (#6926)
* Simplify kts

* Use extensions

* Use extensions

* Simplify kts
2021-11-25 19:41:08 -05:00
3417fd0e78 Update README files to 4.9.3 (#6927) 2021-11-24 09:34:33 -05:00
35bb1740a4 Convert the main build.gradle file to KTS (#6925)
I attempted to do a literal translation as much as possible.
Subprojects now need plugins to be configured directly so they
can use the appropriate syntax.
2021-11-24 07:19:39 +00:00
a87f4b4585 Changelog for OkHttp 4.9.2 2021-09-30 21:13:35 -04:00
e016350e5a Convert module gradle builds files to kts (#6830) 2021-08-12 08:36:23 +01:00
90f8a7d26f Refactor applyOsgi & baselineJar to kotlin (#6823) 2021-08-12 07:52:29 +01:00
ef5d0c83f7 Update README files to 4.9.1 (#6617) 2021-04-10 07:42:40 +01:00
b607bb0aa8 Partial move to gradle kotlin (#6532) 2021-02-06 14:57:47 +00:00
d1cf4944f2 Junit import fail (#6429)
* Missed some imports

* Missed some imports

* Missed some imports
2020-11-19 21:23:18 -05:00
ff959f8fd5 Android Additional Tests (#6420) 2020-11-15 06:42:22 +00:00
59ae0c138d Convert more tests to JUnit 5 (#6366) 2020-11-01 05:46:35 +00:00