Unrelated to the above: Is there a way to set up a...
# http4k
n
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
The is also a lens Header.LOCATION that takes a URL for a more typesafe version
n
Oh nice; I’ll use that. 😄
Header.LOCATION(Uri.of("<http://google.com>"), Response(PERMANENT_REDIRECT))
😄
d
Even better, move on to the nicer lens injection api, and use this form
response.with(lens of value)
n
mind blown
f
Lenses are like Pringles; once you pop, you can't stop
n
Response(PERMANENT_REDIRECT).with(Header.LOCATION of Uri.of("<https://google.com>"))
😄