1.1.3
Client, Apache, CIO, Jetty
JVM 1.8, macOs
Manually settings the header works tho.
Ktor Client 1.1.3 plain JVM, Apache engine.
HttpClient(Apache|Jetty|CIO) { // <-- all 3 engines have the problem
install(Logging) {
level = LogLevel.ALL
}
install(Auth) {
basic {
username = Settings.mainServerUsername
password = Settings.mainServerPassword
}
}
install(JsonFeature) {
serializer = KotlinxSerializer()
}
}
Logging output is:
11:16:45.182 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - REQUEST: http://localhost:8080/api/newCamera
11:16:45.182 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - METHOD: HttpMethod(value=POST)
11:16:45.182 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - HEADERS
11:16:45.182 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - -> Accept: application/json
11:16:45.183 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - BODY Content-Type: application/json
11:16:45.184 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - BODY START
11:16:45.184 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - "TEST"
11:16:45.184 [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - BODY END
11:16:45.290 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - RESPONSE: 401
11:16:45.291 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - METHOD: HttpMethod(value=POST)
11:16:45.291 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - FROM: http://localhost:8080/api/newCamera
11:16:45.292 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - HEADERS
11:16:45.292 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - -> WWW-Authenticate: Basic realm=local-server, charset=UTF-8
11:16:45.292 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - -> Connection: keep-alive
11:16:45.292 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - -> Content-Length: 0
11:16:45.292 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - -> Date: Tue, 19 Mar 2019 10:16:45 GMT
11:16:45.293 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - BODY Content-Type: null
11:16:45.293 [DefaultDispatcher-worker-2] INFO io.ktor.client.HttpClient - BODY START
Having serialization problem as well.
Hi @lamba92, thanks for the report.
The issue was in the logging ResponseObserver.
It fixed in the develop and I also add the test to check for your case.
Basic auth still not working on 1.4.0
Most helpful comment
Basic auth still not working on 1.4.0