* 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>
* 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>
* Move coroutines extensions to okhttp3.coroutines
This has the side-effect of fixing our packaging of this module.
Previously the okhttp-coroutines.jar contained the code from the
:okhttp artifact, not the :okhttp-coroutines artifact. I suspect
something in one of our build steps is incorrectly using the
package names (only) as a cache key, and it should instead be
using the package contents.
* apiDump
* Don't leak response bodies in executeAsync
Also make callers opt in to an unstable coroutines API. If the resource
cleanup coroutines API changes, we'll have to change this API.
Remove the OkHttp experimental API. This is a good enough API as far
as OkHttp is concerned.
* Spotless
* Mechanically tag all new APIs as @ExperimentalOkHttpApi
In a follow-up PR I intend to remove the annotation on any
API that we're willing to commit to for OkHttp 5.0.0.
In a follow-up PR I'd also like to hide all remaining
APIs from Java langauge callers.
* Opt-in ExperimentalOkHttpApi for Android projects too
---------
Co-authored-by: Benoit Quenaudon <benoit@quenaudon.com>
* Switch to assertk.fail
* Use assertFailsWith
* More assertFailsWith
* Use more assertFailsWith
* More assertFailsWith
* More assertFailsWith
* Native image dependencies
* Move JUnit dependency
* Don't lock in a specific implementation class
* Missing finally
* 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)
* 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
* Add a proper Kotlin constructor for Request
This turns out to be very useful throughout our test suite.
* Dump updated API
* Fix multipleTags Kotlin conversion
This is a source-incompatible API change. In particular, Response.body(null)
is no longer source-compatible for Kotlin source.
The upside is tremendous: no need for callers to use !! on Response.body
on every single API call. In the rare cases where a Response doesn't have
a body we use a runtime error. This is unlikely to cause problems in
practice; users don't have reason to read the response body on supporting
responses.