1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-12 10:23:16 +03:00
Commit Graph

127 Commits

Author SHA1 Message Date
hoding
d84edae945 add Kotlin version and update UploadProgress recipe (#9033)
* add Kotlin version and update UploadProgress recipe
2025-08-30 18:01:12 +01:00
Jesse Wilson
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
Yuri Schimke
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
renovate[bot]
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
hoding
a88c5d37f8 Upload progress recipe (#8493) 2024-12-24 10:35:34 +00:00
Jesse Wilson
6bc0862e4e Improve some code comments (#8361) 2024-04-15 10:55:09 -04:00
Jesse Wilson
4becb22672 Make sure we have copyright headers (#8329) 2024-04-04 23:30:42 -04:00
Jesse Wilson
5b27ba7e82 Clarify a comment on shutting down the dispatcher (#8328) 2024-04-04 07:40:21 -04:00
Jesse Wilson
a228fd64cc Reformat with Spotless (#8180)
* Enable spotless

* Run spotlessApply

* Fixup trimMargin

* Re-run spotlessApply
2024-01-07 20:13:22 -05:00
Jesse Wilson
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
Yuri Schimke
f408411ff9 Avoid exposing internal methods (#7734) 2023-04-23 08:05:59 +01:00
Jesse Wilson
847b5af240 Avoid InetAddress.getCanonicalHostName(). (#7607)
Just hard-coding 'localhost' is simpler and avoids problems where
the host machine's IP address has additional DNS registrations.

Closes: https://github.com/square/okhttp/issues/7603
2023-01-02 09:04:37 -05:00
Jesse Wilson
79f50e1911 Add a proper Kotlin constructor for Request (#7208)
* 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
2022-04-04 09:44:43 -04:00
Jesse Wilson
b9267b0ce7 Make Response.body non-null (#7205)
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.
2022-04-02 13:17:00 -04:00
Yuri Schimke
4df75dad1a Okio Path api and examples (#7025) 2022-02-21 19:52:48 +00:00
Goooler
7d9ea7de2c Code cleanups (#6923) 2021-11-23 20:30:03 -05:00
Goooler
8e8c2a6037 Code cleanup (#6831) 2021-08-12 08:26:27 +01:00
Goooler
cc3ce11fc4 Code cleanup and imports (#6822) 2021-08-03 14:52:10 +03:00
Yuri Schimke
083315a473 Launcher for quick tests (#6437) 2020-11-21 13:28:45 +00:00
Yuri Schimke
4036fa55b7 Update remaining junit4 tests (#6421) 2020-11-14 12:21:04 -05:00
Yuri Schimke
c7bd25ff21 Yubikey sample (#6120) 2020-06-10 22:03:20 -04:00
Yuri Schimke
cfbca0e311 Simplify running the wireshark demo (#6101)
* Simplify running the wireshark demo

* Better filtering

* Cleanup

* Comments
2020-05-31 15:38:02 -04:00
Yuri Schimke
72227dfb7a Wireshark Testing sample (#6060) 2020-05-29 08:16:56 +01:00
Jesse Wilson
482f88300f Merge pull request #6040 from square/jwilson.0509.insecureHost
HandshakeCertificates.Builder.addInsecureHost()
2020-05-11 18:04:02 -04:00
Jesse Wilson
1364ea44ae HandshakeCertificates.Builder.addInsecureHost()
This API continues the work started here:
https://github.com/square/okhttp/pull/5872
2020-05-11 17:35:02 -04:00
Yuri Schimke
2d21be1184 Custom trust example & API for certificate decoding (#6032) 2020-05-09 14:40:15 +01:00
Yuri Schimke
0ea6ca0faa Allowlist Sample for connecting to Dev servers (#5868) 2020-03-16 09:09:22 +00:00
Jesse Wilson
08e23fcd02 Add a canceled event to EventListener 2020-02-16 18:20:49 -05:00
Jesse Wilson
c1d50e371f Upgrade Okio and some build dependencies
The new ktlint sorts imports which makes this diff large.

The new japicmp ignores 'final' modifier changes in final classes.

We adopt the Google style for checkstyle.xml.

Okio readByteString() now uses segments more aggressively, so we
need to mitigate that to avoid tracking those segments in a test.
2020-01-11 22:24:12 -05:00
Yuri Schimke
b2168ceb73 Fixup samples (#5699) 2020-01-05 15:14:58 +00:00
Yuri Schimke
b9d30d67ac Samples cleanup 2019-12-08 21:30:01 +00:00
Jesse Wilson
7c802961af Add Kotlin listings for OkHttp recipes doc 2019-09-28 14:00:26 -04:00
Yuri Schimke
2a1f328d58 Add proxy event logging (#5300) 2019-07-25 05:42:32 +01:00
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