Grant Park
01/23/2020, 8:17 PMGrant Park
01/23/2020, 8:24 PMjw
01/23/2020, 8:25 PMGrant Park
01/23/2020, 8:27 PMGrant Park
01/23/2020, 8:30 PMjw
01/23/2020, 8:31 PMGrant Park
01/23/2020, 8:32 PMGrant Park
01/23/2020, 8:32 PMjw
01/23/2020, 8:42 PMfawaad
01/23/2020, 8:56 PMMaurice Jouvet
01/31/2020, 8:37 AMkevin.cianfarini
02/10/2020, 2:36 PMalec
02/10/2020, 2:36 PMkevin.cianfarini
02/10/2020, 2:37 PMalec
02/10/2020, 2:38 PMkevin.cianfarini
02/10/2020, 2:47 PMkevin.cianfarini
02/10/2020, 7:27 PM@POST(...)
suspend fun foo(@Body body: MyObject): Response<Unit>
jw
02/10/2020, 7:43 PMUnit
. Repsonse
is if you want to handle non-200 responses in a non-exceptional waykevin.cianfarini
02/10/2020, 7:43 PMVoid?
iirc. Thanks 🙂voben
02/12/2020, 4:19 PMmkojadinovic
02/14/2020, 7:32 AMCursorWindowAllocationException: Cursor window allocation of 2097152 bytes failed.
with sqldelight (1.2.1) in my KMP library. Any idea what could be the reason?alec
02/14/2020, 10:15 AMmkojadinovic
02/14/2020, 11:23 AMdave08
02/16/2020, 4:18 PMsuspend fun Call.getDownloadSize(
blockingDispatcher: CoroutineDispatcher = OK_IO
)Long = withContext(blockingDispatcher) {
suspendCancellableCoroutine<Long> { cont ->
cont.invokeOnCancellation {
cancel()
}
enqueue(object : Callback {
override fun onFailure(call: Call?, e: IOException) {
cont.resumeWithException(e)
}
fun Response.getDownloadSizeFromHeader(): Long? = header("Content-Range")
?.substringAfter('/')
?.toLongOrNull()
?.also { this.body()?.close() }
fun Response.getDownloadSizeFromBody(): Long? {
body().use {
return it?.contentLength()
}
}
override fun onResponse(call: Call?, response: Response) {
if (!response.isSuccessful) {
cont.resumeWithException(IOException("Unexpected HTTP code: ${response.code()}"))
return
}
try {
val size = response.run {
getDownloadSizeFromHeader() ?: getDownloadSizeFromBody()
}
if (size != null && size != -1L) {
cont.resume(size)
} else {
cont.resumeWithException(IOException("Unknown size"))
}
} catch (e: Exception) {
cont.resumeWithException(e)
}
}
})
}
}
What's the best way to do this (that would work with all S3 compatible storages)?dave08
02/16/2020, 4:20 PMhead()
and the Content-Length
header?Naveenkumar R
02/18/2020, 8:48 PMthrow new Error('Specified protocol was not requested by the client.');
^
Error: Specified protocol was not requested by the client.
Please suggest any solution.
Here is my client implementation
val request = Request.Builder().url("<ws://10.1.0.139:8080/>").build()
val listener = object: WebSocketListener() {
override fun onOpen(webSocket: WebSocket, response: Response) {
Log.d("WebSocket ", response.message)
}
override fun onMessage(webSocket: WebSocket, text: String) {
Log.d("WebSocket ", "onMessage String $text")
}
override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
Log.d("WebSocket ", "onMessage byte")
}
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
Log.d("WebSocket ", "onClosing String $reason")
}
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
Log.d("WebSocket ", "onClosed String $reason")
}
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
Log.d("WebSocket ", "onClosed String ${response?.code.toString()}")
}
}
OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.build()
.newWebSocket(request, listener)
}
Update: 19/02:
Issue is with the method url(). Request.Builder().url("<ws://10.1.0.139:8080/>")
The url method replace the URL scheme with http.
Ofir Bar
02/19/2020, 12:29 PMProfession
that we send to our backend using Retrofit.
data class Profession (
@SerializedName("activeSince") var activeSince : Long?,
@SerializedName("name") var businessName : String?,
@SerializedName("description") var businessDescription : String?,
@SerializedName("licenseImageUrl") var licenseImageUrl : String?
)
Sometimes we send the entire object, but other times, I prefer to only send specific fields (for example, only the businessDescription
and businessName
).
Is it possible to tell retrofit to not include the other 2 fields in the network request? (activeSince
and licenseImageUrl
).
Note: I can’t send activeSince
and licenseImageUrl
as null. Our backend will send me back errors if I attempt to do thatsaket
02/19/2020, 2:59 PMkevin.cianfarini
02/21/2020, 7:17 PMNativeSqliteDriver
is also compatible with linux build targets? The only explicitly stated ones are windows and iOS on the readmesaket
02/21/2020, 7:57 PM