Open flyinprogrammer opened 5 years ago
@violetagg , That is what I need. Do you know if still need help with this?
@odravison we have uri(URI)
isn't this helpful?
I agree with @flyinprogrammer it would be convenient if the HttpClient had a similar "builder" method for Headers or perhaps an overloaded uri() with a Map<String, String> of Query parameters that would be properly encoded and appended to the uri?
Today we make it super easy to create an
HttpClient
with headers that are set, or even conditionally set, for the lifetime of theHttpClient
- which is super cool!https://github.com/reactor/reactor-netty/blob/master/src/main/java/reactor/netty/http/client/HttpClient.java#L611-L624
However, there are cases where APIs use query parameters to achieve clever things. For example, (and I acknowledge this is weak) the Consul API allows (and now discourages) the use of an API security token to be passed to Consul via URI Query Parameter. Today, in order to support this we must use a delegate pattern and override the
uri
methods of anHttpClient
class to inject the token.If we had helper builder functions on the client, similar to the ones we have for headers, the delegate would be unnecessary.
Similarly a URI Fragment builder could also be added.