Setting custom headers on separate instances of `Server`s is misbehaving
What
If you create two instances of a Server (regardless of whether it's for rpc or Horizon) and pass custom headers, the second instance of the server will still have the first instance's custom headers.
In other words,
const s1 = new Server(..., { headers: { "Custom-A": "value" } });
const s2 = new Server(..., { headers: { "Custom-B": "value" } });
s2.someMethod();
invoking someMethod will send both Custom-A and Custom-B headers.
Why
This is occurring because the AxiosClient variable is global shared across all Server instances which inject an interceptor to use the custom headers, so the interceptors are additive.
Known Workarounds
You can refresh the page to get a new AxiosClient instance created and the first construction of a Server will work as intended. You may also be able to work around this by using the noaxios bundle.
This is a blocker for the Laboratory unless the noaxios variant fixes this.