bitkid
03/16/2020, 2:39 PMnapperley
03/16/2020, 9:50 PMcy
03/17/2020, 9:38 AMspierce7
03/18/2020, 4:49 AMribesg
03/18/2020, 9:25 AMByteReadChannel
passed as response.content
inside a ResponseObserver
is now cancelled after updating from Ktor Client 1.3.0 to 1.3.2, what are we supposed to do with that?gregorbg
03/18/2020, 4:14 PMCORS
feature as per https://ktor.io/servers/features/cors.html and everything works for GET
. However with POST
it seems that Chrome (version 80.0.3987.106) does not send the Origin
header, so the ktor intercept function does not reply with the Access-Control-Allow-Origin
header as it should. If I enforce the response header through the DefaultHeaders
feature, POST
works but then for GET
Chrome complains because it does send the Origin
header there and so with CORS
+ DefaultHeaders
feature the response header is being set twice (and Chrome doesn't like that...). Any clue how I can work around this issue without waiting for Google to fix their stuff?
EDIT: Not only does Chrome not send Origin
headers when `POST`ing by default, it also explicitly removes them when I instruct my frontend (JavaScript fetch
) to send an Origin
header along with the request.Rui
03/18/2020, 10:37 PMchandrut
03/19/2020, 6:48 AMJohn Peña
03/19/2020, 3:48 PMMadhan
03/20/2020, 6:36 AMChristian Sousa
03/20/2020, 1:50 PMHttpClient{
expectSuccess = false
HttpResponseValidator {
validateResponse { response ->
println("RESP: $response")
}
handleResponseException { cause ->
println("CAUSE: $cause")
}}
}
But my code doesnt even reach any of those, either the validateResponse
nor the handleResponseException
.
With my other api calls, i can see them entering the validateResponse
, but not the one that gives me a 403.
Anyone can help?Darren Bell
03/20/2020, 5:10 PMval myResponse = client.get<HttpResponse>(getHostRequestUrl("/api/getObject"))
if (myResponse .status != HttpStatusCode.OK) {
log.error("Issue making service request : Status Code : ${workloadResponse.status}")
}
val myObject = parseClusterListResponse(myResponse.readText())
The deprecation error says something like:
Using 'HttpResponse' is an error. Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead
But I dont think that is appropriate. Am I wrong?bjonnh
03/20/2020, 9:42 PMJamy
03/21/2020, 6:35 AMMantas Varnagiris
03/22/2020, 3:27 PMfun Route.handleFile() {
post("/handleFile") {
call.respondTextWriter {
appendln("Writing some output while file is being processed")
// Handle file that will create another file for user to download
call.respondFile(outputFile) // I know I cannot do this
}
}
}
Basically I want to run a long running task and show some text to the user about the progress and then after it finished that output file should be downloaded. Is that even possible to do just within ktor?carrot
03/22/2020, 5:50 PMMarcin Wisniowski
03/22/2020, 5:56 PMBino
03/23/2020, 11:48 AMgabin
03/23/2020, 3:57 PMspierce7
03/23/2020, 5:49 PM<http://io.ktor.utils.io|io.ktor.utils.io>.errors.IOException
for all network IO exceptions across platforms?zero_coding
03/23/2020, 8:55 PMLastExceed
03/24/2020, 10:36 AM@JsonValue
to make the serialization work, but what about the deserialization?pavlospt
03/24/2020, 10:53 AMHttpClient
usage. If I want to execute an API call when someone “hits” a specific endpoint, do I just need to call <http://client.post|client.post>(…)
inside the route callback, or am I missing something? It is like the call is never executed and cancelled after the specified timeout..! Thanks in advance!Jeremy Guijt
03/25/2020, 8:26 AMuserId
is missing then I would like to have a response saying "Claim 'userId' is missing". I don't think it's currently possible in Ktor and I would like to add it to Ktor.
Can any of you offer some insight in whether (a) this is a good feature and (b) how I would go about adding this?
The Java library that parses the JWT returns useful information in an exception, but this information is then discarded and an empty UnauthorizedResponse is sent. I think the solution is to add this information to the UnauthorizedResponse as a response body.Jeremy Guijt
03/25/2020, 8:28 AMMartin Tøften
03/25/2020, 4:21 PMGabriel Feo
03/25/2020, 4:31 PMSam Garfinkel
03/25/2020, 6:49 PMShan
03/25/2020, 11:10 PMhost
? Doing this is not working:
val httpClient = HttpClient(Android) {
defaultRequest {
contentType(ContentType.Application.Json)
url {
host = currentBuildEnvironment.defaultEndpoint
protocol = URLProtocol.HTTPS
}
}
}
//elsewhere..
fun makeRequest() = <http://httpClient.post|httpClient.post> {
url {
encodedPath = "/endpoint"
host = currentBuildEnvironment.otherEndpoint
}
body = //etc
}
It's using defaultEndpoint
instead of otherEndpoint
. Am I missing something here?Sergey Akhapkin
03/25/2020, 11:29 PM@KtorExperimentalLocationsAPI
@Location("/auth")
object Auth {
@Location("/phone")
object ByPhone {
@Location("/confirm")
object Confirmation
}
}
and I've a simple test:
@Test
fun authLocationsTest() {
withTestApplication {
assertEquals("/auth", application.locations.href(Auth))
assertEquals("/auth/phone", application.locations.href(Auth.ByPhone))
assertEquals("/auth/phone/confirm", application.locations.href(Auth.ByPhone.Confirmation))
}
}
which is failed with:
Expected :/auth/phone/confirm
Actual :/phone/confirm
Is that expected behavior and somehow related to https://github.com/ktorio/ktor/issues/1660 or I should file a bug report ?Sergey Akhapkin
03/25/2020, 11:29 PM@KtorExperimentalLocationsAPI
@Location("/auth")
object Auth {
@Location("/phone")
object ByPhone {
@Location("/confirm")
object Confirmation
}
}
and I've a simple test:
@Test
fun authLocationsTest() {
withTestApplication {
assertEquals("/auth", application.locations.href(Auth))
assertEquals("/auth/phone", application.locations.href(Auth.ByPhone))
assertEquals("/auth/phone/confirm", application.locations.href(Auth.ByPhone.Confirmation))
}
}
which is failed with:
Expected :/auth/phone/confirm
Actual :/phone/confirm
Is that expected behavior and somehow related to https://github.com/ktorio/ktor/issues/1660 or I should file a bug report ?@KtorExperimentalLocationsAPI
@Location("/auth")
object Auth {
@Location("/phone")
object ByPhone {
@Location("/confirm")
class Confirmation(val byPhone: ByPhone = ByPhone)
}
}
this code (plus expected changes to test) works as expected. Perhaps it should be reflected better in documentation then.