An extrapolation of this into http4k could be a variant of the Client and Request that use an indirection of some sort instead of the explicit hostnames
n
natpryce
07/24/2019, 5:28 AM
We do something like this, using filters to replace abstract service URIs with absolute HTTP URLs. This way, there’s no need for a special variant of client or request. It all falls out nicely of HTTP4K’s existing abstractions.
d
dave
07/25/2019, 1:06 PM
yep - you can simply provide a simple filter which will replace the hostname - we do this already in
ClientFilters.SetBaseUriFrom
. This means that your API client code can just set the path and method, like
Request(GET, "/api/bob")
and let the underlying httphandler which you are calling do the discovery of the hostname