kevin.cianfarini
02/12/2020, 11:36 PMSourabh Rawat
02/14/2020, 7:46 AMApplication
when using koin.ribesg
02/14/2020, 2:16 PMAustin
02/14/2020, 5:43 PMSourabh Rawat
02/14/2020, 6:20 PMJaxon Du
02/15/2020, 7:59 AMrrader
02/15/2020, 11:34 AMCLOVIS
02/15/2020, 2:15 PMtwisterrob
02/15/2020, 3:54 PM[Test worker] ktor.test(ApplicationEngineEnvironmentReloading.kt:135) NoThis is how I use tests (ktor 1.3.1):patterns specified, automatic reload is not activektor.deployment.watch
private fun endpointTest(test: TestApplicationEngine.() -> Unit) {
withTestApplication(
{ /* I apply my `fun Application.module()` setup here */ },
test
)
}
How can I fix that message?Grantas33
02/15/2020, 7:52 PMio.ktor.client.features.RedirectResponseException: Unhandled redirect
Ben Woodworth
02/15/2020, 8:05 PMjava.lang.UnsupportedOperationException: The only generic classes supported for now are standard collections, got class class ResponseEnvelope
It looks like the solution to this was to use KotlinxSerializer.setMapper(...)
in the HttpClientConfig
, but that's been deprecated.
Here is the erroring line of code:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/GroupMe.kt#L75
Here is ResponseEnvelope, the class I want to deserialize:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/ResponseEnvelope.kt
Here is the ktor HttpClient declaration:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/src/main/kotlin/net/benwoodworth/groupme/GroupMe.kt#L53-L61
And here is my build.gradle:
https://github.com/BenWoodworth/GroupMe.kt/tree/63b918c8d5a6c0a4aa3316ab76214beb72986e3d/build.gradle
Any idea how I might be able to fix this?Leon K
02/16/2020, 4:26 PMio.ktor.client.features.SendCountExceedException: Max send count 20 exceeded
This appears when i use the basic auth feature, give it the wrong username and password and then try to get data from a backend. When i manually add the Authorization: Basic
header, it works fine
Any Ideas what causes this and how i could solve it? I'm using ktor 1.3.0Arkangel
02/16/2020, 10:20 PMMrPowerGamerBR
02/16/2020, 10:41 PMMrPowerGamerBR
02/17/2020, 11:06 AMSet-Cookie
header on static files, even if the session wasn't changed.
While this isn't a super huge issue, it also sends the Set-Cookie
header for assets (like css, js, etc) and that breaks Cloudflare's cache (it always bypasses the cache)Tamas
02/17/2020, 7:57 PMval updates = call.receive<List<PositionPatch>>()
however I receive List<LinkedHashMap
. when I send / receive just one object, then it works like a charm.
is there a way to influence the binding?napperley
02/17/2020, 8:56 PMvitaly
02/18/2020, 2:13 PMThomas
02/18/2020, 8:45 PMConnectException
. Is the code below correct or is there a better way to do this?
client.install("HttpsToHttp") {
requestPipeline.intercept(HttpRequestPipeline.Before) {
val requestBuilder = this.context
try {
proceedWith(it)
} catch (exception: ConnectException) {
if (requestBuilder.url.protocol == URLProtocol.HTTPS) {
requestBuilder.url.protocol = URLProtocol.HTTP
proceedWith(requestPipeline.execute(requestBuilder, it)) // not sure if this is correct
} else {
throw exception
}
}
}
}
Gyuhyeon
02/19/2020, 9:07 AM.receive()
response using ktor client to access HttpResponse
while also accessing the response body as a type?
What I mean is,
ktorClient.request<HttpStatement> {...}.receive<HttpResponse>()
seems to be one way to receive responses while
ktorClient.request<HttpStatement> {...}.receive<MyJsonModel>()
seems to be a way to receive the body as a predefined data class.
However, due to needs in highly customized logging and whatnot, I need a way to access HttpResponse along with parsing it into MyJsonModel.
What I would've preferred is something along the lines of
val response = ktorClient.request<HttpStatement> {...}.receive<HttpResponse>()
// do things with response and then...
return response.parseBodyAs(MyJsonModel::class.java)
but there doesn't seem to be a way to do so. Do I have to parse myself using serializers manually if I decide to receive as HttpResponse
?pandawarrior
02/20/2020, 11:04 AMcy
02/20/2020, 12:19 PM@Location("/api/{version}")
class Api(val version: Int) {
@Location("/user/{id}")
class User(val id: String, val api: Api = Api(1)) {
// here API presence looks required,
// otherwise, there is no way to find a version value
// so now we demand the api parameter to exist
}
}
The other point is that one can't just move a nested class outside without additional manual changes:
@Location("/root")
class Outer {
@Location("/child")
class Child // it is tied to /root/child path
}
@Location("/child")
class Child // this is tied to just /child
@Location("/child2")
class Child2(val outer: Outer) // -> /root/child2
The cause of the second change is that objects should be symmetric with classes, and one can't add a constructor property to an object. The unfortunate consequence is that one can't write like this anymore:
@Location("/api")
object Api {
@Location("/info")
object Info
}
Should be migrated to the following:
@Location("/api")
object Api {
@Location("/info")
class Info(val api: Api = Api)
// the api parameter is required, weird isn't it
}
The question is: do these changes affct many, does anybody use structured locations with nested objects?Smith
02/20/2020, 1:04 PMSlackbot
02/20/2020, 8:31 PMaltavir
02/21/2020, 8:45 AMplotly.kt
to newer ktor version and encountered a problem. I need to get a host name from request in order to send a data request to the same server but with different address. Previously I was using call.request.host()
for that, but now for some reason on localhost it returns IP6 adress 0.0.0.0.0.0.0.0, which is not friendly with JS backward requests. Are there any better way to treat this situation?Jaxon Du
02/21/2020, 2:08 PMSmith
02/22/2020, 2:03 PMLeon K
02/22/2020, 4:52 PMJoakimForslund
02/24/2020, 12:25 PMvar result: T? = null
try {
println("FFFFFFFfffff - 2")
result = httpClient?.request(httpRequestBuilder)
} catch (e: Exception) {
println("FFFFFFFfffff - 3: ${e.cause} -> ${e.message}")
throw e.cause!!
} finally {
println("FFFFFFFfffff - 4: ${result}")
return result
}
Essentially the result ends up with null, which is not weird because it is initially set as such, however the httpClient?.request does not throw an error and the result is still null
The httpClient is initialized, and the engine is also initialized. I'm confused as to whySaood
02/24/2020, 1:39 PMIos.create {
configureRequest {
}
}
i have delegate method for certificate validation
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void)
is Anyone tried ?Saood
02/24/2020, 1:39 PMIos.create {
configureRequest {
}
}
i have delegate method for certificate validation
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void)
is Anyone tried ?Thomas
02/24/2020, 2:48 PM