Открыть боковую панель
Aurora OS
Kotlin Multiplatform
Libraries
ktor
Коммиты
f1612a49
Коммит
f1612a49
создал
Июл 13, 2018
по автору
Leonid Stashevsky
Просмотр файлов
Make TypeInfo data class, add tests
- #459 #471
владелец
e07ca10d
Изменения
4
Скрыть пробелы
Построчно
Рядом
gradle.properties
Просмотр файла @
f1612a49
version
=
0.9.4-SNAPSHOT
kotlin_version
=
1.2.5
0
kotlin_version
=
1.2.5
1
coroutines_version
=
0.23.3-dev-1
dokka_version
=
0.9.16
...
...
ktor-client/ktor-client-core/src/io/ktor/client/call/TypeInfo.kt
Просмотр файла @
f1612a49
...
...
@@ -3,11 +3,19 @@ package io.ktor.client.call
import
java.lang.reflect.*
import
kotlin.reflect.*
class
TypeInfo
(
val
type
:
KClass
<
*
>,
val
reifiedType
:
Type
)
/**
* Ktor type information.
* [type]: source KClass<*>
* [reifiedType]: type with substituted generics
*/
data class
TypeInfo
(
val
type
:
KClass
<
*
>,
val
reifiedType
:
Type
)
@PublishedApi
()
internal
open
class
TypeBase
<
T
>
/**
* Create typeInfo from <T>
*/
inline
fun
<
reified
T
>
typeInfo
():
TypeInfo
{
val
base
=
object
:
TypeBase
<
T
>()
{}
val
superType
=
base
::
class
.
java
.
genericSuperclass
!!
...
...
ktor-client/ktor-client-core/test/io/ktor/client/tests/features/cookies/TypeInfoTest.kt
0 → 100644
Просмотр файла @
f1612a49
package
io.ktor.client.tests.features.cookies
import
io.ktor.client.call.*
import
kotlin.test.*
class
TypeInfoTest
{
@Test
fun
classInMethodTest
()
{
class
Foo
typeInfo
<
Foo
>()
}
@Test
@Ignore
fun
`type
info
with
class
defined in method scope with complex name`() {
class
SomeClass
typeInfo
<
SomeClass
>()
}
@Test
fun
equalsTest
()
{
class
Foo
<
Bar
>
assertEquals
(
typeInfo
<
Foo
<
Int
>>(),
typeInfo
<
Foo
<
Int
>>())
assertNotEquals
(
typeInfo
<
Foo
<
String
>>(),
typeInfo
<
Foo
<
Int
>>())
assertNotEquals
(
typeInfo
<
Foo
<
Int
>>(),
typeInfo
<
Foo
<
Char
>>())
}
}
\ Нет новой строки в конце файла
ktor-client/ktor-client-jetty/src/io/ktor/client/engine/jetty/JettyResponseListener.kt
Просмотр файла @
f1612a49
...
...
@@ -70,7 +70,7 @@ internal class JettyResponseListener(
onHeadersReceived
.
complete
((
frame
.
metaData
as
?
MetaData
.
Response
)
?.
let
{
val
(
status
,
reason
)
=
it
.
status
to
it
.
reason
reason
?.
let
{
HttpStatusCode
(
status
,
reason
)
}
?:
HttpStatusCode
.
fromValue
(
status
)
reason
?.
let
{
HttpStatusCode
(
status
,
it
)
}
?:
HttpStatusCode
.
fromValue
(
status
)
})
}
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать