If I’m fetching from a server via the Apache clien...
# http4k
d
If I’m fetching from a server via the Apache client, it follows redirects, but if I connect direct in memory it doesn’t. Is there any existing way (a filter;-) of making in-memory work the same way?
d
ClientFilters.FollowRedirects
d
Lucky guess
d
It's aways a filter!
s
@dmcg is the http4k-apache client following redirects by default? We usually turn those off so we don't depend on the client-specific implementation
d
you can make a fake browser by doing
Copy code
val handler = ClientFilters.FollowRedirects()
        .then(ClientFilters.Cookies(storage = cookieStorage()))
        .then(ApacheClient())
It's how we test oauth flows in memory 🙂
d
I don’t suppose there’s a ClientFilters.Cookie Store?
Dammit, beat me to it
d
you will also need to put a
reverseProxy
in so that the redirect goes to the "other" handler" if there is one
d
Mind reading support
d
the short answer is that THERE IS ALWAYS A FILTER (or similar 🙂 )
Mind reading support
And all for one low low price!
you're all so damn predictable
d
Haddock
d
ServerFilters.BestFishForFrying()