galex
02/15/2019, 5:09 AM"IllegalArgumentException: should should be greater than write space + end gap (size = 9, writeRemaining = 0, endGap = 8, rem+gap = 8
at IllegalArgumentException_init_0 (<http://localhost:9000/bundle.js:162304:32>)
at require$ObjectLiteral_1.doFail (<http://localhost:9000/bundle.js:34344:9>)
at IoBuffer.writeBufferAppend_ehtrw3$ (<http://localhost:9000/bundle.js:35661:7>)
at ByteReadPacket_0.ByteReadPacketBase.prepareRead_87ik6q$ (<http://localhost:9000/bundle.js:31628:10>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31444:15>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31455:19>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31455:19>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31455:19>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31455:19>)
at ByteReadPacket_0.ByteReadPacketBase.readAsMuchAsPossible_v6e8td$_0 (<http://localhost:9000/bundle.js:31455:19>)"
I post via client.submitForm {}
and I’ve tried submitFormWithBinaryData {}
as well, no differences 😞tjb
02/17/2019, 12:01 AMval client = HttpClient() {
install(BasicAuth) {
username = "test"
password = "pass"
}
install(JsonFeature) {
serializer = GsonSerializer()
}
}
AllowFlame
02/18/2019, 3:28 AMJonathan Mew
02/18/2019, 10:53 AMdewildte
02/19/2019, 3:10 PMMockEngine
?alexfacciorusso
02/20/2019, 11:17 AMhttpClient.get<Result<MyApiResponseType>>(...)
and getting a result object that will contain its success/fail state, the exception etc.ziad
02/20/2019, 3:29 PMkevin
02/20/2019, 8:03 PMspierce7
02/20/2019, 10:49 PMHttpResponse
as a String? We are finding crashes when we do things like response.content.readUTF8Line()
davidasync
02/21/2019, 5:09 AMContent-type
?davidasync
02/21/2019, 3:04 PMengine block
and customizeClient block
?
val clientCall = HttpClient(Apache){
engine {
socketTimeout = config?.timeoutMsec ?: 10_000
connectTimeout = config?.connectTimeout ?: 10_000
connectionRequestTimeout = 20_000
customizeClient {
setProxy(requestProxyHost)
socketTimeout = config?.timeoutMsec ?: 10_000
connectTimeout = config?.connectTimeout ?: 10_000
connectionRequestTimeout = 20_000
}
}
}
fkrauthan
02/21/2019, 8:36 PMdavidasync
02/22/2019, 3:37 AMRequest cannot be executed; I/O reactor status: STOPPED
What does it mean ?Riccardo Montagnin
02/22/2019, 6:09 AMSergey Bondari
02/22/2019, 6:22 AMdavidasync
02/22/2019, 8:23 AMsuspend fun main () = coroutineScope {
var counter = 1
launch {
while (true) {
HttpClient(Apache) {
engine {
}
}.use {
val clientResponse = it.call {
method = <http://HttpMethod.Post|HttpMethod.Post>
url(URL("<https://httpbin.org/post>"))
body = TextContent(bodyVal, contentType = ContentType("application", "json"))
}.response
val jsonResponseString = String(clientResponse.readBytes())
println(counter.toString())
counter += 1
}
}
}
println("abc")
}
legzo
02/22/2019, 9:50 AMThreadLocal
.
I saw that kotlinx.coroutines.slf4j
introduces MDCContext()
and that, this way, you can launch some coroutines passing them MDC data. But is there a way I can use it to propagate my MDC data to the underlying OkHttp calls ?davidasync
02/22/2019, 4:09 PMdavidasync
02/23/2019, 3:07 PMfun exec () {
GlobalScope.launch {
var counter = 1
val httpClient = HttpClient(Apache)
while (true) {
val clientResponse = httpClient.use {
it.call {
method = <http://HttpMethod.Post|HttpMethod.Post>
url(URL("<https://httpbin.org/post>"))
body = TextContent(bodyVal, contentType = ContentType("application", "json"))
}.response
}
val jsonResponseString = String(clientResponse.readBytes())
println(counter.toString())
counter += 1
}
}
}
suspend fun main () = coroutineScope {
exec()
Thread.sleep(1000000)
}
Is it because I use .use{
?bootstraponline
02/23/2019, 4:56 PMserver.start(wait = false)
however the server never stops.
server.stop(1, 1, TimeUnit.SECONDS)
server.application.dispose()
result in the process staying alive, even though the netty worker pool is freed. Is there a way to fully stop the server and let the process naturally exit?bdawg.io
02/23/2019, 11:13 PMktor-auth
idiomatic way to return a 403 Forbidden
for a found principal?
I am able to authenticate the user with their credentials, but I committed to the clients that I would return a forbidden respond when the user is not authorized with a certain permission.davidasync
02/24/2019, 6:27 AMtjb
02/24/2019, 6:00 PM?myParam=text,2.0
?Sander Ploegsma
02/25/2019, 7:59 AMsuspend
functions in parallel inside a route? This compiles but crashes at runtime with `io.ktor.util.pipeline.SuspendFunctionGun cannot be cast to kotlinx.coroutines.CoroutineScope`:
fun Routing.test() {
get("/") {
val firstResultDeferred = async { firstCall() }
val secondResultDeferred = async { secondCall() }
val firstResult = firstResultDeferred.await()
val secondResult = secondResultDeferred.await()
call.respond(listOf(firstResult, secondResult))
}
}
stanislav
02/25/2019, 10:12 AM// 10:18:47 4.FEB.2019
// dateRaw: GMTDate = GMTDate(seconds=47, minutes=18, hours=10, dayOfWeek=MONDAY, dayOfMonth=4, dayOfYear=35, month=FEBRUARY, year=2019, timestamp=1549275527000)
val date = dateRaw.toJvmDate()
// date: Date (JVM/Android) — Mon Feb 25 13:07:27 GMT+03:00 2019 (CURRENT DATE)
dewildte
02/25/2019, 4:34 PMobobo
02/25/2019, 9:48 PMCoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>)
and then uses async
on it to create the Deferreds. My question is whether this is the correct way to do this, or if I should use the coroutineScope
function to create the scope and call async
from within. Unsure if this is a #ktor or #coroutines question, seems more like the former.Patrick Jackson
02/26/2019, 12:02 AMDavide Giuseppe Farella
02/26/2019, 2:26 AMfun `playlist realTest`() {
val source = ParsersImpl()
runBlocking {
source.readFrom(
Playlist("<https://sourcetv.info/dl/01/it29.m3u>", SourceFile.Type.REMOTE ),
onChannel = { println( it ) },
onGroup = { println( it ) },
onError = { println( "${it.reason.name} - ${it.rawChannel}" ) }
)
}
}
The http call resides here: override suspend fun readBytes( path: String ) = client.get<ByteArray>( path )
The problem is that when I run my Android app, 9/10 gives me the following exceptionfabian
02/26/2019, 9:12 PMContentConverter
like the JacksonConverter
is installed?fabian
02/26/2019, 9:12 PMContentConverter
like the JacksonConverter
is installed?Sergey Bondari
02/26/2019, 9:41 PMpost("/foo") {
call.receiveStream().use {
// raw bytes from input body
}
// or
call.receiveChannel() // will give you a ByteReadChannel primitive for the lowest level reading routine.
}
there are many flavors of receive. When you have JSON transformer, you can do call.receive<Foo>()
and it will attempt to deserialize payload into a Foo
class instancefabian
02/26/2019, 10:53 PM