mirror of
https://github.com/square/okhttp.git
synced 2025-08-08 23:42:08 +03:00
Do IDNA mapping on Kotlin/JS (#7800)
This commit is contained in:
@@ -7,8 +7,23 @@ kotlin {
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
if (kmpJsEnabled) {
|
||||
js(IR) {
|
||||
nodejs()
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(libs.squareup.okio)
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
implementation(libs.squareup.okio.nodefilesystem)
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api(projects.okhttp)
|
||||
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Square, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package okhttp3
|
||||
|
||||
import okio.FileSystem
|
||||
import okio.Path
|
||||
import okio.Path.Companion.toPath
|
||||
|
||||
val okHttpRoot: Path
|
||||
get() = getEnv("OKHTTP_ROOT")!!.toPath()
|
||||
|
||||
expect val SYSTEM_FILE_SYSTEM: FileSystem
|
||||
|
||||
expect fun getEnv(name: String): String?
|
||||
|
||||
expect val isJvm: Boolean
|
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Square, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package okhttp3
|
||||
|
||||
import okio.FileSystem
|
||||
import okio.NodeJsFileSystem
|
||||
|
||||
actual fun getEnv(name: String) = js("globalThis.process.env[name]") as String?
|
||||
|
||||
actual val SYSTEM_FILE_SYSTEM: FileSystem = NodeJsFileSystem
|
||||
|
||||
actual val isJvm = false
|
@@ -22,6 +22,7 @@ import java.net.UnknownHostException
|
||||
import java.util.Arrays
|
||||
import okhttp3.internal.http2.Header
|
||||
import okio.Buffer
|
||||
import okio.FileSystem
|
||||
import org.junit.jupiter.api.Assumptions.assumeFalse
|
||||
import org.junit.jupiter.api.Assumptions.assumeTrue
|
||||
|
||||
@@ -122,3 +123,9 @@ object TestUtil {
|
||||
block(suppressed.toList())
|
||||
}
|
||||
}
|
||||
|
||||
actual fun getEnv(name: String) = System.getenv(name)
|
||||
|
||||
actual val SYSTEM_FILE_SYSTEM = FileSystem.SYSTEM
|
||||
|
||||
actual val isJvm = true
|
Reference in New Issue
Block a user