github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/api/plugin/connection_wrapper.go (about)

     1  package plugin
     2  
     3  //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . ConnectionWrapper
     4  
     5  // ConnectionWrapper can wrap a given connection allowing the wrapper to modify
     6  // all requests going in and out of the given connection.
     7  type ConnectionWrapper interface {
     8  	Connection
     9  	Wrap(innerconnection Connection) Connection
    10  }
    11  
    12  // WrapConnection wraps the current Client connection in the wrapper.
    13  func (client *Client) WrapConnection(wrapper ConnectionWrapper) {
    14  	client.connection = wrapper.Wrap(client.connection)
    15  }