ribesg
06/20/2019, 11:58 AM<http://client.post|client.post>(url)
<http://client.post|client.post>(url) { body = EmptyContent }
serebit
06/21/2019, 4:50 AMquiqua
06/21/2019, 11:40 AMTestApplicationEngine
and withTestApplication
?
Also do I have to call server.start
with TestApplicationEngine
?Vojtech Hrdina
06/21/2019, 1:54 PMtseisel
06/22/2019, 10:40 AMKenneth
06/22/2019, 11:02 AMcall.receive<User>()
give me a User with fields as null?lenqnr
06/23/2019, 6:00 AMError: Could not find or load main class ApplicationKt
message. And I realized that the IDEA execute java command without build output directories in -classpath
option. What could possibly cause this problem?
I spent about four days on this. Really need help.Marc Knaup
06/23/2019, 2:35 PMHttpResponsePipeline
should allow passing additional info - not just a TypeInfo
.
I'd like to pass the KSerializer
which should be used for example since it's for a generic type.
The feature or json serializer could then use the additional info to correctly deserialize the response.Saša Šijak
06/23/2019, 7:01 PMMatej Drobnič
06/24/2019, 5:41 AMspand
06/24/2019, 8:01 AMlenqnr
06/24/2019, 9:00 AMKevin Schmeichel
06/24/2019, 6:26 PMIntDeserializer()
? maybe try removing that line, gson can deserialize Ints automatically.Horv
06/24/2019, 7:12 PMapplication.conf
variable1: value1
variable2: value2
application-dev.conf
variable3: value3
And be able to run the application with both application.conf
and application-dev.conf
applied. Or possibly 1 config file but evaluate different configs depending on environment variables. When reading up on HOCON
I couldn't find it it supports any kind of ternary operator or so.galex
06/25/2019, 1:39 PMio.ktor.http.Url
inside io.ktor:ktor-client-ios
for iOS? I get the following error:
e: /Users/myUser/MyProject/Myclass.kt: (3, 8): Unresolved reference: io
jeggy
06/25/2019, 2:21 PMpyryjook
06/25/2019, 7:45 PMException in thread "main" java.lang.IllegalStateException: Could not find "~/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-curl-macosx64/1.2.2/9d410c6f439ecde9618172b2d276cb4459109ec3/ktor-client-curl.klib" in [~/CLionProjects/untitled, ~/.konan/klib, ~/.konan/kotlin-native-macos-1.2.1/klib/common, ~/.konan/kotlin-native-macos-1.2.1/klib/platform/macos_x64].
Shan
06/26/2019, 4:46 AMGauthierPLM
06/26/2019, 9:01 AMdavidasync
06/26/2019, 10:45 AMsuspend fun main () = coroutineScope {
var counter = 1
val client = HttpClient{}
val response = client.get<HttpResponse>("<https://httpbin.org/get>")
println(response.status)
}
If I defined the HttpClient like that code, is it mean I use CIO engine ?Marc Knaup
06/26/2019, 10:54 AMUrl
is only to be used for HTTP-based URLs?
It messes up URLs with other schemes like file
or custom
.
(It should probably be called HttpUrl
in that case 🤔)davidasync
06/26/2019, 1:33 PMSergioedcigreja
06/26/2019, 3:12 PMdavidasync
06/27/2019, 5:06 AMthreadsCount
at engine
is it similar with setting thread pool size at coroutineScope at executorService.asCoroutineDispatcher()
?
And what happened if we set threadsCount at engine and use executorService.asCoroutineDispatcher()
davidasync
06/27/2019, 10:34 AMmaxConnectionsPerRoute
,
Does it will count our route and set counter for each route ?
Is there any documentation how it works ?Santosh Astagi
06/27/2019, 3:08 PMAlexander Weickmann
06/27/2019, 3:26 PM<http://call.application.environment.log.info|call.application.environment.log.info>("")
tjohnn
06/28/2019, 5:48 AMapplication/json
, does it make sense to fail a FormAuth gracefully if request Content-Type is json like this?
provider.pipeline.intercept(AuthenticationPipeline.RequestAuthentication) { context ->
var postParameters: Parameters? = null
if(!call.isJsonRequest()){
postParameters = call.receiveOrNull()
}
val username = postParameters?.get(userParamName)
val password = postParameters?.get(passwordParamName)
val credentials = if (username != null && password != null) UserPasswordCredential(username, password) else null
val principal = credentials?.let { validate(call, it) }
if (principal != null) {
context.principal(principal)
} else {
val cause = if (credentials == null) AuthenticationFailedCause.NoCredentials else AuthenticationFailedCause.InvalidCredentials
context.challenge(formAuthenticationChallengeKey, cause) {
when (challenge) {
FormAuthChallenge.Unauthorized -> call.respond(HttpStatusCode.Unauthorized)
is FormAuthChallenge.Redirect -> call.respondRedirect(challenge.url(call, credentials))
}
it.complete()
}
}
}
voben
06/28/2019, 5:58 AMinstall(StatusPages) {
exception<Throwable> { cause ->
log.error(cause)
val error = HttpBinError(HttpStatusCode.InternalServerError, call.request.local.uri, cause.toString(), cause.cause?.message)
call.respond(HttpStatusCode.InternalServerError, error)
}
}
More info on here https://ktor.io/servers/features/status-pages.htmlJonas Bark
06/28/2019, 1:27 PMjs().compilations["main"].defaultSourceSet {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Libs.coroutines_version}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Libs.serialization_version}")
implementation("io.ktor:ktor-client-js:${Libs.ktor_version}")
implementation("io.ktor:ktor-client-json-js:${Libs.ktor_version}")
implementation("io.ktor:ktor-client-serialization-js:${Libs.ktor_version}")
implementation("io.ktor:ktor-client-logging-js:${Libs.ktor_version}")
}
}
js().compilations["test"].defaultSourceSet {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-test-js")
implementation("io.mockk:mockk:${Libs.mockk_version}")
}
}
js {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
when trying to run the jsTest task I'm getting errors that e.g. utf-8-validate is missing:
Module not found: Error: Can't resolve 'utf-8-validate'
@ .._imported/ktor-ktor-client-core/1.2.2/ktor-ktor-client-core.js
I'm using latest ktor 1.2.2. Want me to open an issue? It seems it's related to ktor.