* New Response.peekTrailers() API
This restores behavior we had in OkHttp 4.x that I
broke when I changed Response.trailers() to block
until trailers were available.
Closes: https://github.com/square/okhttp/issues/8916
* apiDump
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
The semantics of the old path property included the query string,
and should be mapped from the new `target` which is the equivalent
field in the new recorded request. Using url.encodedPath only
provides the path component and omits the query component, resulting
in a breaking change.
* Change RecordedRequest.chunkSizes to be nullable
Now that it's all Kotlin we can usefully distinguish
between null (not chunked) and empty list (chunked with
zero bytes).
Also remove the experimental annotation from RecordedRequest
and delete the experimental annotation.
* apiDump
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Update dependency org.robolectric:robolectric to v4.15
* Skip test on early robolectric
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yuri Schimke <yuri@schimke.ee>
* 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>
Also rename 'sequenceNumber' to 'exchangeIndex'.
This may be useful to test features like connection
reuse.
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Permit RecordedRequest.body to be null or empty
Null if we didn't capture a body, and empty if we
captured an empty body.
* Track API change
* Fixup more tests
* 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
* Drop the parameters-based JUnit 5 extension
I think the @StartStop one is sufficient.
---------
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>
* 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
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Change some MockWebServer ergonomics
Now calling MockWebServer.port and similar functions will
not implicity start the server. It is instead necessary to
explicitly call the start() function.
The problem with the old behavior was that reading the
port field could fail with an IOException, which is weird
behavior for reading a property.
* Fixup test
* Fix another test
---------
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
* Decompose the request line into individual properties
Replace the 'path' property with the URL's encodedPath
property.
Rename the 'requestUrl' property to 'url'.
* Spotless
* Fix up DnsOverHttpsTest
* Fix some test failures