Skip to content

Support header forwarding

Compare
Choose a tag to compare
@potterbm-cb potterbm-cb released this 21 Oct 23:08
· 5 commits to master since this release
9d1c0df

What Changed: Header Forwarding

With v0.8.6 of mesh-sdk-go we released a utility to help with header forwarding between rosetta requests/responses and native node requests/responses. (For more context see the linked release notes.)

This update uses that utility to add support for header forwarding using the SupportHeaderForwarding and ForwardHeaders options in the rosetta configuration.

Updated mesh-sdk-go version

This release now requires v0.8.6 or higher of mesh-sdk-go

Changes needed in custom clients

Add WithRPCTransport method

If you want to use header forwarding, RPC clients passed to utils.Bootstrap need to implement the ReplaceableRPCClient interface. The function signature of WithRPCTransport should look like:

func (ec *MyClientType) WithRPCTransport(endpoint string, transport http.RoundTripper) (ReplaceableRPCClient, error)

NOTE: Your client also needs to implement construction.Client so that it can be casted back from ReplaceableRPCClient. However, the function signature of utils.Boostrap already requires this so that should already be the case.

Other changes

  • the utils.Bootstrap method will re-create the passed-in client if necessary to enable header forwarding
  • the client.NewClient method now accepts an optional http.RoundTripper to configure the internal RPC client