Skip to content

Commit

Permalink
Deduplicate HttpUrl tests and documentation (#7814)
Browse files Browse the repository at this point in the history
  • Loading branch information
squarejesse authored May 11, 2023
1 parent b11a6a8 commit 4fc5185
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 1,683 deletions.
1 change: 0 additions & 1 deletion native-image-tests/src/main/resources/testlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ okhttp3.FormBodyTest
okhttp3.HandshakeTest
okhttp3.HeadersKotlinTest
okhttp3.HeadersTest
okhttp3.HttpUrlGetTest
okhttp3.HttpUrlTest
okhttp3.InsecureForHostTest
okhttp3.InterceptorTest
Expand Down
15 changes: 14 additions & 1 deletion okhttp/src/commonMain/kotlin/okhttp3/HttpUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
package okhttp3

import kotlin.jvm.JvmName
import kotlin.jvm.JvmStatic
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull

/**
* A uniform resource locator (URL) with a scheme of either `http` or `https`. Use this class to
Expand Down Expand Up @@ -501,6 +502,11 @@ expect class HttpUrl internal constructor(

internal val url: String

/**
* Alternating, decoded query names and values, or null for no query. Names may be empty or
* non-empty, but never null. Values are null if the name has no corresponding '=' separator, or
* empty, or non-empty.
*/
internal val queryNamesAndValues: List<String?>?

/**
Expand Down Expand Up @@ -595,6 +601,9 @@ expect class HttpUrl internal constructor(
internal var encodedQueryNamesAndValues: MutableList<String?>?
internal var encodedFragment: String?

/**
* @param scheme either "http" or "https".
*/
fun scheme(scheme: String): Builder
fun username(username: String): Builder

Expand All @@ -604,6 +613,10 @@ expect class HttpUrl internal constructor(

fun encodedPassword(encodedPassword: String): Builder

/**
* @param host either a regular hostname, International Domain Name, IPv4 address, or IPv6
* address.
*/
fun host(host: String): Builder
fun port(port: Int): Builder

Expand Down
Loading

0 comments on commit 4fc5185

Please sign in to comment.