While implementing stellar/stellar-cli#1583 (CLI should support rpc providers which require an API key) we discovered that we needed to rework how we're creating new rpc clients so that we could allow users to pass in custom HTTP headers. The change made as part of #1583 is not very flexible if a user needs to change more than just the headers.
We should design a more flexible way to create rpc clients that allow for more customization. A couple of suggestions were:
- use the builder pattern
- allow a user to pass in an HttpClient
Based on these discussions:
While implementing stellar/stellar-cli#1583 (CLI should support rpc providers which require an API key) we discovered that we needed to rework how we're creating new rpc clients so that we could allow users to pass in custom HTTP headers. The change made as part of #1583 is not very flexible if a user needs to change more than just the headers.
We should design a more flexible way to create rpc clients that allow for more customization. A couple of suggestions were:
Based on these discussions: