Marko Kunic
01/11/2022, 4:58 PM.env
variables into ktor before starting local env or running tests?snowe
01/12/2022, 5:11 AMJsonFeature
even if I have ktor-client-json
as a dependency? It was working at some point and now I cannot get it to work, even if I create a new project using the ktor intellij creator. Maven is just completely unable to resolve the .json.
package.Florentin Simion
01/12/2022, 2:15 PMSuspendFunctionGun
in respect to the naive implementation of DebugPipelineExecutor
? @e5l maybe you can help me understand, as you are one of the main committers, Thank you!Chris C
01/12/2022, 3:13 PMio.ktor:ktor-client-core:2.0.0-beta-1
and i’m running into this error:
Uncaught Kotlin exception: kotlin.IllegalArgumentException: Failed to open iconv for charset ISO-8859-1 with error code 22
at kfun:kotlin.Throwable#<init>(kotlin.String?){} (0x44cb61)
at kfun:kotlin.Exception#<init>(kotlin.String?){} (0x4464bd)
at kfun:kotlin.RuntimeException#<init>(kotlin.String?){} (0x44665d)
at kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} (0x44697d)
at kfun:io.ktor.utils.io.charsets.checkErrors#internal (0x729962)
at kfun:io.ktor.utils.io.charsets.CharsetImpl.<init>#internal (0x7289cd)
at kfun:io.ktor.utils.io.charsets.Charsets#<init>(){} (0x72f4b3)
at InitSingletonStrict (0x61a64d)
at (0x85bffc)
at Kotlin_initRuntimeIfNeeded (0x638c06)
at Init_and_run_start (0x436296)
at __libc_start_main (0x7f82ef801c8d)
at (0x41d767)
at ((nil))
This is running on our Alpine Linux build server which has iconv available
echo 'foo' | iconv -f ISO-8859-1 -t ASCII
foo
Any ideas what’s going on here?Zhiqiang Bian
01/12/2022, 4:36 PMrefreshTokens
function? For example, without the WWW-Authenticate
header?
https://ktor.io/docs/auth.html#bearer
3. Specify how to obtain a new token if the old one is invalid using refreshTokens. Note that this block will be called after receiving a 401 (Unauthorized) response with the WWW-Authenticate header.
Jim
01/13/2022, 11:04 PMspierce7
01/14/2022, 3:55 AMHassaan
01/14/2022, 6:12 AMAlexander Suraphel
01/14/2022, 10:59 AMGradle Core Plugins (plugin is not in 'org.gradle' namespace)
The project is just a single module build ( no top level buiild.gradle.kts file) How do i fix this?Alexander Suraphel
01/14/2022, 2:09 PMContentNegotiation
. Am I missing a dependency?martmists
01/14/2022, 3:20 PMspierce7
01/15/2022, 1:46 AMStatusPages
plugin, using the Throwable
catch all.
install(StatusPages) {
exception<Throwable> {
call.respond(HttpStatusCode.InternalServerError)
}
}
dimitar_
01/15/2022, 12:03 PMLocations
I have a problem configuring a simple POST
endpoint. I have the following code:
@Location("/v1/login")
class Login
post<Login> {
...
}
But I get 404s. If I change it to get<Login> {…}
everything is ok.
Can’t seem to find any examples using post
and Locations
Alexander Suraphel
01/15/2022, 2:11 PMAkram Bensalem
01/16/2022, 10:02 AMcurl --location -g --request POST '<https://svform.herokuapp.com/createUser/{userName}/{mobileNumber}>' \
--form 'profileImage=@"/Users/akram/Documents/14_07_2020-hbtu_kanpur_20509722.jpg"'
So I write a code like this:
@OptIn(InternalAPI::class)
suspend fun creatUser(
context : Context,
userName: String,
mobileNumber:String,
image: Uri,
) = client
.submitFormWithBinaryData<MemberEntity>(
url = "$POST_NEW_USER/$userName/$mobileNumber",
formData = formData {
append(
key = "profileImage",
value = getBinaryFile(context = context, contentUri = image)!!
)
},
){
onUpload { bytesSentTotal, contentLength ->
println("Sent $bytesSentTotal bytes from $contentLength")
}
}
I got an error of type :
Serializer for class 'BinaryItem' is not found.
When I add the ContentType, I got another error
Header(s) [Content-Type] are controlled by the engine and cannot be set explicitly
.....
Please any help ?Sergei
01/16/2022, 10:53 AMAlexander Suraphel
01/16/2022, 2:22 PMAlexander Suraphel
01/16/2022, 3:13 PMStefan Oltmann
01/17/2022, 2:03 PMvar delta: DropboxDelta = post("$DROPBOX_API_URL/files/list_folder") {
contentType(ContentType.Application.Json)
body = Parameters.build {
append("path", "/")
append("recursive", "true")
append("include_non_downloadable_files", "false")
}.formUrlEncode()
}
Client request(https://api.dropboxapi.com/2/files/list_folder) invalid: 400 Bad Request. Text: "Error in call to API function "files/list_folder": request body: expected object, got string"
For OAuth I can use this construct:
return tokenClient.submitForm(
url = tokenUrl,
formParameters = Parameters.build {
append("grant_type", "authorization_code")
append("code", authorizationCode)
append("client_id", clientId)
}
)
But that does not work with list_folder
Can someone share an example how to do this?Hamza Maqsood
01/17/2022, 2:29 PMmp
01/17/2022, 3:12 PMAlexander Suraphel
01/18/2022, 12:46 PMapplication.conf
. Can I do it inside the embeddedServer
call?martmists
01/19/2022, 8:58 AMmartmists
01/19/2022, 2:28 PMClaude Brisson
01/19/2022, 5:56 PMAlexander Suraphel
01/20/2022, 10:38 AMrouting {
static("assets") {
files("css")
files("js")
}
}
Does files("css")
look for the folder css
and/or files with the extension .css
?Alexander Suraphel
01/20/2022, 10:40 AMСтефан Јовановић
01/21/2022, 2:46 PMspierce7
01/22/2022, 7:12 AMCoroutineContext
that’s used for all requests? I swear there was a way to do this that I read a while ago, but I can’t find it in the documentation.
If I use an Authentication provider, currently that authentication information is only stored inside the call
. I’d like to create a custom CoroutineContext
for each request, so that anywhere in the server that I’m in a suspend
function, I can get the userId, instead of having to pass it through to every method call in my server.brabo-hi
01/25/2022, 1:37 AMHttpClient
with CIO
when using WebSockets
. But it looks working fine with Http ?
Here is the error i am getting Kotlin multiplatform: JobCancellationException: Parent job is Completedbrabo-hi
01/25/2022, 1:37 AMHttpClient
with CIO
when using WebSockets
. But it looks working fine with Http ?
Here is the error i am getting Kotlin multiplatform: JobCancellationException: Parent job is CompletedAleksei Tirman [JB]
01/25/2022, 8:39 AMbrabo-hi
01/25/2022, 5:31 PMclass MyService {
private val client= HttpClient {
install(WebSockets)
}
fun openSocket() {}
fun closeSocket(code: Int, reason: String) {}
fun sendMessage(msg:String) {}
}
The issue was when using the same instance of MyService
val myService = MyService()
myService.sendMessage();
Here i want to reuse the same myService
instead of creating a new instance each time i want to start a new connection