github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/communicator/BodyHandler.go (about)

     1  package communicator
     2  
     3  import "io"
     4  import "github.com/Ingenico-ePayments/connect-sdk-go/communicator/communication"
     5  
     6  // BodyHandlerFunc is a handler function for an incoming body stream
     7  type BodyHandlerFunc func(headers []communication.Header, reader io.Reader) error
     8  
     9  // BodyHandler is a handler for an incoming body stream
    10  type BodyHandler interface {
    11  	Handle(headers []communication.Header, reader io.Reader) error
    12  }
    13  
    14  // Handle calls f(statusCode, headers, reader)
    15  func (f BodyHandlerFunc) Handle(headers []communication.Header, reader io.Reader) error {
    16  	return f(headers, reader)
    17  }