File tree 2 files changed +19
-1
lines changed
kotlin-jupyter-plugin/common-dependencies/src/main/kotlin/org/jetbrains/kotlinx/jupyter/common
src/test/kotlin/org/jetbrains/kotlinx/jupyter/test/repl
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ import kotlinx.serialization.json.JsonElement
8
8
import kotlinx.serialization.json.JsonObject
9
9
import org.http4k.asString
10
10
import org.http4k.client.ApacheClient
11
+ import org.http4k.core.HttpHandler
11
12
import org.http4k.core.Method
12
13
import org.http4k.core.Request
13
14
import org.http4k.core.Response
15
+ import org.http4k.core.then
16
+ import org.http4k.filter.ClientFilters
14
17
import java.io.IOException
15
18
import java.util.Base64
16
19
@@ -19,8 +22,12 @@ class ResponseWrapper(
19
22
val url : String ,
20
23
) : Response by response
21
24
25
+ fun createHttpClient (): HttpHandler {
26
+ return ClientFilters .FollowRedirects ().then(ApacheClient ())
27
+ }
28
+
22
29
fun httpRequest (request : Request ): ResponseWrapper {
23
- val client = ApacheClient ()
30
+ val client = createHttpClient ()
24
31
val response = client(request)
25
32
26
33
return ResponseWrapper (response, request.uri.toString())
Original file line number Diff line number Diff line change @@ -102,6 +102,17 @@ class ReplWithStandardResolverTests : AbstractSingleReplTest() {
102
102
assertEquals(44 , res4.resultValue)
103
103
}
104
104
105
+ @Test
106
+ fun testHttpRedirection () {
107
+ val res = eval(
108
+ """
109
+ %use jep@url[https://github.com/hanslovsky/jepyter/releases/download/jepyter-0.1.8/jep.json]
110
+ 1
111
+ """ .trimIndent()
112
+ ).resultValue
113
+ assertEquals(1 , res)
114
+ }
115
+
105
116
@Test
106
117
fun testLocalLibrariesStorage () {
107
118
@Language(" json" )
You can’t perform that action at this time.
0 commit comments