1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-26 06:43:09 +03:00
Commit Graph

94 Commits

Author SHA1 Message Date
Jesse Wilson
eb7a0839ab Suppress AllMainsTest.
It won't work in CI
2019-06-24 14:28:12 -07:00
Yuri Schimke
26949cf478 Fix samples and add test (#5228)
* Fix samples

* support different paths

* Simplify
2019-06-24 05:59:42 -07:00
Jesse Wilson
8bb58332db Extension Functions toRequestBody(), toResponseBody() 2019-05-25 14:02:55 -04:00
Jesse Wilson
dedc6ecd5b Use more AssertJ features 2019-03-14 17:57:42 -04:00
Jesse Wilson
aac6c8da07 Introduce EventListener.requestFailed, responseFailed events
These replace requestBodyEnd() / responseBodyEnd() in some failure scenarios.
They may also be issued in cases where no event was published previously.
2019-02-23 18:39:11 -05:00
Jesse Wilson
778e0334a4 Use lambdas where appropriate 2019-01-11 22:31:36 -05:00
Jesse Wilson
bcbbfc6a54 Make the nested BasicAuthInterceptor static (#4368) 2018-11-05 07:46:46 +00:00
jjshanks
0a8f418644 Add basic auth interceptor recipe (#4336) 2018-11-04 18:05:01 +00:00
Joshua Shanks
c951e6ed88 APIs to set date headers 2018-10-31 08:32:50 -07:00
Jesse Wilson
c07b8fddc9 HTTPS server sample 2018-07-12 22:46:57 -04:00
Jake Wharton
36f4fd04f7 Add parse overload which fails on invalid inputs 2018-07-05 23:18:15 -04:00
Yuri Schimke
fe445e4db6 Improve progress example (#3744)
* improve progress example

* bad import
2017-12-28 13:43:43 -05:00
Yuri Schimke
d6fd0d3832 Fix travis build 2017-09-12 08:32:24 +01:00
jwilson
b926a030c6 Add samples for EventListener 2017-09-06 12:11:37 -04:00
jwilson
83b9dd4275 Upgrade to Checktyle 7.7.
This allows us to put @Nullable immediately preceding the return type,
which is exactly where we want it.
2017-05-06 14:21:55 -04:00
jwilson
2d37490174 Add a sample where data is streamed via an Okio pipe. 2017-03-22 21:07:56 -04:00
Jesse Wilson
bdcd06f8ca Merge pull request #3091 from square/jwilson.0107.custom_cipher_siutes
Example on customizing cipher suites.
2017-01-07 21:33:20 -05:00
jwilson
cbe7baa474 Fix examples to give up if authentication fails.
Closes: https://github.com/square/okhttp/issues/2464
2017-01-07 18:45:32 -05:00
jwilson
bb0f81e1b8 Example on customizing cipher suites.
It's a disgusting amount of code unfortunately.

Closes: https://github.com/square/okhttp/issues/2698
2017-01-07 18:28:26 -05:00
jwilson
949439ae5b Rename NewWebSocket to WebSocket.
The synchronous WebSocket class is gone.
2016-11-19 15:16:58 -05:00
jwilson
40dddb9dcf Migrate MockWebServer to the async web sockets API. 2016-11-18 21:34:02 -05:00
Jake Wharton
90f6bcb21f Remove inconsistent 'send' prefix from message/ping methods. 2016-10-11 23:08:49 -04:00
Jake Wharton
6306aec01d Use ByteString for web socket ping/pong payloads. 2016-09-20 00:53:36 -04:00
Jake Wharton
508eb90b3c Web socket API and implementation improvements.
* onFailure callback's exception type widened to Throwable. This allows runtime exceptions from other callbacks to be passed along.
* Ensure the connection is closed properly for all failures.
* Fix and document the threading inside RealWebSocket. This ensures the listener is always called on the same thread and replies always happen from the correct thread.
2016-09-19 23:53:55 -04:00
Jake Wharton
039bcf92db Move WebSockets from separate artifact to main.
The factory method has moved to OkHttpClient and WebSocketCall has changed to an interface.
2016-09-13 12:29:19 -04:00
Jonh Wendell
7b2cbab2b7 Improve WebSocketEcho example
Shutdown the executor upon close or failure. This avoids the program
hanging after finished the execution.

Set the client read timeout to 0 (the default timeout is 10s). A read
timeout doesn't make sense for a WebSocket.
2016-08-13 13:40:20 -03:00
jwilson
3699d5c9fd Better documentation and examples on closing response bodies.
Also implement Closeable on Response to make it easier to do the right thing.
2016-05-21 21:29:42 -04:00
jwilson
94bda42362 Pin fewer certificates in our sample.
Closes: https://github.com/square/okhttp/issues/2535
2016-05-07 18:21:50 -04:00
jwilson
ad103f421e Use Moshi in OkHttp.
As discussed here: https://github.com/square/okhttp/pull/2492
2016-04-21 23:20:30 -10:00
jwilson
85f74e2004 Accept user-provided trust managers in OkHttpClient.Builder
Closes: https://github.com/square/okhttp/issues/2427
2016-03-28 19:02:25 -04:00
jwilson
7396ac00bc Implement support for SHA-256 pins.
Closes: https://github.com/square/okhttp/issues/1539
2016-02-21 18:38:04 -05:00
Dave Roberge
0f4d824418 Updated gson recipe to close response body. 2016-01-16 13:52:53 -05:00
jwilson
8ff3725031 Change Callback to take a Call.
This makes it much easier to test if the call was canceled.

Note that the Call's request is always the original user request.
This is different than the previous request that was passed in, as
that could have been the follow up to a redirect.
2016-01-11 15:40:28 -08:00
jwilson
a2d9f7cfa9 Adjust documentation for OkHttp 3. 2016-01-02 09:34:47 -05:00
jwilson
7826bcb2fb Fix some get prefixes on Cache and ConnectionPool. 2016-01-02 02:07:30 -05:00
jwilson
21d6303418 Restore no-args constructor for OkHttpClient.
This is a popular API and keeping it working is handy.
2016-01-01 15:22:14 -05:00
jwilson
38d570a6b2 Drop get and set prefixes in OkHttpClient, OkHttpClient.Builder 2016-01-01 12:12:35 -05:00
jwilson
f2461183e8 Refactor towards an OkHttpClient.Builder.
Still some work to do on method naming, but this was the interesting part.
Also very much need to rename OkUrlFactory in tests to urlFactory, otherwise
the client.client stuff becomes madness.
2016-01-01 10:55:32 -05:00
jwilson
e7023e0344 Sort more imports and wrap documentation at 100 columns.
This is a mechanical refactoring. The only thing I had trouble with is IntelliJ's
weak support for `<ul>` tags in Javadoc.
2015-12-23 19:37:17 -05:00
jwilson
02d6b4e78c Drop the get prefix on Connection accessors. 2015-12-21 21:10:48 -05:00
Jesse Wilson
a7605a62f7 Merge pull request #2126 from square/jwilson_1217_authenticator3
One authenticate method on the authenticator interface.
2015-12-18 10:28:10 -05:00
jwilson
0bfd604857 One authenticate method on the authenticator interface.
Instead of having one instance of Authenticator, and that interface
defines two methods, we now have two instances of Authenticator and
that interface defines one method.

This prevents leaking request-specific configuration (the authenticator)
into shared connection configuration (the proxy authenticator).
2015-12-18 09:56:53 -05:00
Jake Wharton
d1f94df145 Querying the response content-length never does I/O. 2015-12-17 19:15:12 -05:00
jwilson
c9a89876de Rename com.squareup.okhttp to okhttp3
Maven group changes will come in follow up.
2015-12-16 01:34:59 -05:00
Jesse Wilson
52fa3cf24d Merge pull request #2105 from square/jw/no-throws
Remove IOException from source() and streams.
2015-12-15 20:54:08 -05:00
Jesse Wilson
f5d0abd059 Merge pull request #2101 from square/jw/model
Convert form-encoding body to model-based version.
2015-12-15 09:42:44 -05:00
Jake Wharton
c642bea938 Remove Request#urlString(), just use url().toString(). 2015-12-15 00:33:09 -05:00
Jake Wharton
dcb3c14435 Remove IOException from source() and streams. 2015-12-15 00:05:34 -05:00
Jake Wharton
6711a2b670 Convert form-encoding body to model-based version.
Update the Multipart version as well to match some conventions.
2015-12-14 22:39:14 -05:00
Jake Wharton
93d547dcda Make HttpUrl the blessed URL method of Request. 2015-12-14 15:11:48 -05:00