https://kotlinlang.org logo
#ktor
Title
# ktor
c

Czar

03/13/2020, 2:08 AM
when this is executed, response contains redirect 302 and the code throws UnhandledRedirectionException. if I do the same request with httpie, I get status 200 and correct response. Am I doing something wrong with ktor client?
e

e5l

03/13/2020, 4:58 AM
Hi @Czar, it should be problem with the redirect feature. What version of ktor do you use? Btw if your data isn't sensitive, could you install
Logging
feature(for headers) and post it? It could help to clarify why redirect didn't happen.
c

Czar

03/13/2020, 9:26 AM
Ktor.ALL.log
🙏 1
ktor version 1.3.1
e

e5l

03/13/2020, 9:27 AM
It looks like you're using the
post
method. Redirect is forbidden for the post
c

Czar

03/13/2020, 9:38 AM
there should not be a redirect there in the first place, with any other client I tried there is no redirect. Ktor is doing something weird with the request.
the endpoint normally just returns 200 with a
application/json
response
It was me, everything works. when testing with outside of app clients I was using URL with
www
but with ktor
www
was missing, that's why the server was redirecting...
🕵️‍♂️ 1
4 Views