https://kotlinlang.org logo
#http4k
Title
# http4k
n

Nezteb

04/25/2019, 12:11 AM
Unrelated to the above: Is there a way to set up a redirect? From one route to another?
Nevermind, figured it out
Copy code
Response(PERMANENT_REDIRECT).header("location", "<http://google.com>")
d

dave

04/25/2019, 2:33 AM
The is also a lens Header.LOCATION that takes a URL for a more typesafe version
n

Nezteb

04/25/2019, 2:35 AM
Oh nice; I’ll use that. 😄
Header.LOCATION(Uri.of("<http://google.com>"), Response(PERMANENT_REDIRECT))
😄
d

dave

04/25/2019, 5:05 AM
Even better, move on to the nicer lens injection api, and use this form
response.with(lens of value)
n

Nezteb

04/25/2019, 5:13 AM
mind blown
f

fredrik.nordin

04/25/2019, 7:54 AM
Lenses are like Pringles; once you pop, you can't stop
n

Nezteb

04/25/2019, 2:42 PM
Response(PERMANENT_REDIRECT).with(Header.LOCATION of Uri.of("<https://google.com>"))
😄
4 Views