1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-23 06:42:24 +03:00
Commit Graph

12 Commits

Author SHA1 Message Date
Jesse Wilson
4d1f8add89 Confirm we send SNI server names on the JDK9 Platform (#7597)
This introduces a new API in MockWebServer's RecordedRequest to
capture the inbound server names.

Co-authored-by: Yuri Schimke <yuri@schimke.ee>
2023-01-04 07:59:45 +10:00
Jesse Wilson
ebb6e92d93 Use classes where appropriate in SocketPolicy (#7622)
* Use classes where appropriate in SocketPolicy

* Track API changes
2023-01-03 11:37:42 -05:00
Jesse Wilson
3ea6b81e5c Make SocketPolicy a sealed interface (#7610)
* Make SocketPolicy a sealed interface

* Dump APIs
2023-01-02 15:13:13 -05:00
Jesse Wilson
34bb12533b Public API for duplex streams in MockWebServer (#7595)
* Public API for duplex streams in MockWebServer

I'm not 100% on the name 'Stream' for the source+sink pair. It's
tempting to use 'Socket', though I think that's an implementation name
and this is an abstraction that uses a different implementation.

I've chosen Stream specifically 'cause it's the word used in the
HTTP/2 spec. My biggest gripe with it is that it's bidirectional
in the HTTP/2 spec, but Java InputStream and OutputStream are not
bidirectional.

* Dump APIs for streams

* Don't include a Content-Length header for chunked bodies

* Convert MockWebServerTest to Kotlin (#7596)

* Rename .java to .kt

* Convert Java to Kotlin

* Null isn't special for last-write wins

* Attempt to make NonCompletingRequestBody less flaky
2022-12-31 13:24:52 -05:00
Jesse Wilson
c30d3ce7b7 Create MockResponseBody (#7593)
* Create MockResponseBody

We'd previously only ever used Buffer to model the type
of the MockResponse body. This has proven inadequate, particularly
for features like duplex responses.

Most of the complexity in this PR is changing how throttling
and disconnect-during-body work when we don't necessarily have
a Buffer for the response body.

This is a first step, more capability to follow.

* Update API

* We flush fewer times now

* Attempt to make a test less flaky

* Try harder to make the test less flaky
2022-12-31 14:47:55 +10:00
Jesse Wilson
3ca2e64744 Clean up some Mockwebserver3 internals (#7582) 2022-12-29 06:27:59 +10:00
Jesse Wilson
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
Yuri Schimke
f27a291975 Add tests for multiple routes (#7563) 2022-12-24 10:26:45 +10:00
Jesse Wilson
afc7fa3700 Delete the unused tunnelProxy argument (#7317)
* Delete the unused tunnelProxy argument

* Update API spec
2022-06-09 13:14:05 -04:00
Jesse Wilson
fd6452596c Implement CONNECT tunnels for HTTP/2 prior knowledge (#7314)
* Implement CONNECT tunnels for HTTP/2 prior knowledge

Closes: https://github.com/square/okhttp/issues/7289

* Update the API spec for MockWebServer

* It is okay for HTTP/2 prior knowledge to send data early

Tests were failing due to an overly-pessimistic 'too much buffering'
exception. I moved the detector to where it's actually needed.
2022-06-08 13:55:16 -04:00
Jesse Wilson
513a5435c0 Change how HTTP 1xx responses work in MockWebServer (#7169)
* Change how HTTP 1xx responses work in MockWebServer

Previously this was a SocketPolicy. With this change each
response may carry 0 or more informational responses which
are transmitted before the ultimate response.

* Add a test for multiple 1xx responses

* Update API
2022-03-19 20:17:50 -07:00
Jesse Wilson
3e16ec28fe Adopt Kotlin's binary compatibility validator (#7112) 2022-02-26 14:17:33 -05:00