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

68 Commits

Author SHA1 Message Date
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
Yuri Schimke
fb22f4973e Update to official GraalVM tooling (#8613) 2024-12-21 10:56:29 +02:00
Yuri Schimke
61ab31ab1d Simplify the DnsOverHttps logic (#8383)
* Simplify the logic.

Rely on OkHttpClient caching, instead of a cache only request.

* Simplify the logic.

Rely on OkHttpClient caching, instead of a cache only request.
2024-11-18 20:00:37 -05:00
ᡠᠵᡠᡳ ᡠᠵᡠ ᠮᠠᠨᡩ᠋ᠠᠨ
ce9fc58b8d Skip protocol warning since QUIC supports multiplexing too (#8563) 2024-10-31 09:27:31 +00:00
Jesse Wilson
d2e91f7cb4 Change parameter order for Cache constructor (#8338)
* Change parameter order for Cache constructor

Put FileSystem before Path, as is convention.

Also put this new constructor in the public API.

* apiDump

* Track the change in RunSurvey

* Track signature change
2024-04-10 15:46:48 -04:00
Yuri Schimke
737efdeb0c Cache URL Override (#8234)
* Add a cacheUrlOverride

* Add a cacheUrlOverride

* Add a cacheUrlOverride

* Add a cacheUrlOverride

* Add a cacheUrlOverride

* Add Cache Test

* Add Cache Test

* Fix test

* Update okhttp/src/main/kotlin/okhttp3/Request.kt

Co-authored-by: Jesse Wilson <jwilson@squareup.com>

* Update okhttp/src/test/java/okhttp3/CacheTest.kt

Co-authored-by: Jesse Wilson <jwilson@squareup.com>

* Update okhttp/src/test/java/okhttp3/CacheTest.kt

Co-authored-by: Jesse Wilson <jwilson@squareup.com>

* Update okhttp/src/test/java/okhttp3/CacheTest.kt

Co-authored-by: Jesse Wilson <jwilson@squareup.com>

---------

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2024-03-22 07:09:21 +00:00
Yuri Schimke
a16dcecfeb Allow constructor injection of MockWebServer (#8191) 2024-01-14 10:20:09 +00: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
Jesse Wilson
23d67c304f Switch to assertFailsWith (#8177)
* 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
2024-01-06 00:31:00 -05:00
Jesse Wilson
eb6c016f6f Stop using AssertJ (#8174)
* Stop using AssertJ

This completes the migration to assertk.

* Fix a missing import

* Fix some type issues
2024-01-04 00:32:07 -05:00
Jesse Wilson
9724956cb4 Convert more tests from Java to Kotlin (#8155) 2023-12-23 10:26:25 +00:00
Yuri Schimke
f408411ff9 Avoid exposing internal methods (#7734) 2023-04-23 08:05:59 +01: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
Jesse Wilson
a62974de39 Remove DnsRecordCodec from our public API (#7113) 2022-02-27 10:23:43 -05:00
Goooler
5cfc040daf Replace StandardCharsets with Charsets in Kotlin (#6986) 2022-01-08 16:17:43 +00: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
be518bc3eb Fix DoH tests for android (#6751) 2021-07-12 08:44:35 +01:00
Yuri Schimke
858939f025 DOH non experimental (#6452) 2020-11-29 10:07:20 -05:00
Yuri Schimke
083315a473 Launcher for quick tests (#6437) 2020-11-21 13:28:45 +00:00
Yuri Schimke
d1cf4944f2 Junit import fail (#6429)
* Missed some imports

* Missed some imports

* Missed some imports
2020-11-19 21:23:18 -05:00
Yuri Schimke
ff959f8fd5 Android Additional Tests (#6420) 2020-11-15 06:42:22 +00:00
Yuri Schimke
4036fa55b7 Update remaining junit4 tests (#6421) 2020-11-14 12:21:04 -05:00
Jesse Wilson
59ae0c138d Convert more tests to JUnit 5 (#6366) 2020-11-01 05:46:35 +00:00
Yuri Schimke
86b7ba5f2a Enable BouncyCastle on Android and add some testing (#5936) 2020-04-11 17:35:27 +01:00
Yuri Schimke
19771365f2 Rename to src/main/kotlin (#5938)
Follows the default path logic for kotlin classes.
2020-04-11 17:15:25 +01:00
Jesse Wilson
ca0c8d6a1a Prepare for release 4.5.0. 2020-04-06 10:54:10 -04:00
Yuri Schimke
46fcf4f42c Fix for infinite caching in DoH (#5918)
Hit the cache only initially, but avoid using stale cached data.
2020-04-02 12:58:26 +01: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
16173e2af9 Make Platform.log exception parameter optional (#5482)
Make Platform.log exception parameters optional, and reorders to allow level defaulting to INFO.
2019-09-29 16:59:58 +10:00
Yuri Schimke
6903b89e0b Cleanup of error prone and warnings (#5268)
* Comment some warnings

* Wrap

* Disable warnings
2019-07-15 21:11:35 -04:00
Jesse Wilson
22a420b3a2 Remove the Kotlin migration bridges from DnsOverHttps (#5157)
We promise no API stability in this package.
2019-06-02 07:19:16 +01:00
Jesse Wilson
12eb1c10c8 Merge pull request #5123 from square/idiomatic-kotlin-dnsoverhttps
Idiomatic Kotlin in DnsOverHttps.kt
2019-05-27 20:33:53 -04:00
Jesse Wilson
53ba4dd9ef Replace MediaType.get(string) with string.toMediaType() (#5132) 2019-05-27 06:38:35 +01:00
Masaru Nomura
f0a580070e Idiomatic Kotlin in DnsOverHttps.kt
- define the following vals in constructor instead of passing `builder: Builder`.
  - `@get:JvmName(...)` val
    - `client: OkHttpClient`
    - `url: HttpUrl`
    - `includeIPv6: Boolean`
    - `post: Boolean`
    - `resolvePrivateAddresses: Boolean`
    - `resolvePublicAddresses: Boolean`
  - `private` val
    - `systemDns: Dns`
    - `bootstrapDnsHosts: List<InetAddress>?`

- add `@Deprecated(...)` to the following functions.
  - `fun client(): OkHttpClient`
  - `fun url(): HttpUrl`
  - `fun includeIPv6(): Boolean`
  - `fun post(): Boolean`
  - `fun resolvePrivateAddresses(): Boolean`
  - `fun resolvePublicAddresses(): Boolean`
2019-05-26 16:28:07 -04:00
Jesse Wilson
8bb58332db Extension Functions toRequestBody(), toResponseBody() 2019-05-25 14:02:55 -04:00
Jesse Wilson
9c20f17270 Use vals in OkHttpClient 2019-05-25 10:34:25 -04:00
Jesse Wilson
8e96075fcd Merge pull request #5116 from TangHuaiZhe/dev
Replace !isEmpty with isNotEmpty
2019-05-25 09:49:25 -04:00
Jesse Wilson
f87bb6d817 Reorder the members of OkHttpClient (#5114)
This isn't perfect but I think it's a bit more logical.
2019-05-25 06:50:37 +01:00
Tang HuaiZhe
376b9a4e59 Replace !isEmpty with isNotEmpty 2019-05-25 12:00:05 +08:00
Masaru Nomura
7ad4f970ba Idiomatic Kotlin for Response.kt
- define `@get:JvmName(...)` for the following vals in constructor instead of passing `builder: Builder`.
  - `request: Request`
  - `protocol: Protocol`
  - `message: String`
  - `code: Int`
  - `handshake: Handshake?`
  - `headers: Headers`
  - `body: ResponseBody?`
  - `networkResponse: Response?`
  - `cacheResponse: Response?`
  - `priorResponse: Response?`
  - `sentRequestAtMillis: Long`
  - `receivedResponseAtMillis: Long`
  - `exchange: Exchange?`

- add `@Deprecated(...)` to the following functions.
  - `fun request(): Request`
  - `fun protocol(): Protocol`
  - `fun message(): String`
  - `fun code(): Int`
  - `fun handshake(): Handshake?`
  - `fun headers(): Headers`
  - `fun body(): ResponseBody?`
  - `fun networkResponse(): Response?`
  - `fun cacheResponse(): Response?`
  - `fun priorResponse(): Response?`
  - `fun sentRequestAtMillis(): Long`
  - `fun receivedResponseAtMillis(): Long`
  - `fun cacheControl(): CacheControl`

- clean up code where `()`(parentheses) is unnecessarily used.
2019-05-24 16:16:29 -04:00
Jesse Wilson
030dbeae26 Delete unwanted whitespace.
I think the convert-to-Kotlin feature adds these
2019-05-22 21:12:55 -04:00
Jesse Wilson
e67ec3c51e Adopt HttpUrl's new Kotlin API 2019-05-20 21:01:04 -04:00
Jesse Wilson
0b89e0ee59 Use apply {} in builders 2019-05-20 19:55:47 -04:00
Jesse Wilson
2c59337e31 Use check/require instead of if/throw 2019-05-20 19:02:41 -04:00
Jesse Wilson
2e0dfa29d0 Don't use @JvmStatic for internal calls 2019-05-20 16:00:40 -04:00
Yuri Schimke
dcf5c8ceb6 Fix/Simplify regex usage (#5059)
* Fix/Simplify regex usage

* Cleanup
2019-05-18 06:33:34 -04:00
Yuri Schimke
f3949c23bc Spotless code formatter 2019-04-10 22:44:58 +01:00