~egtann/lanhttp

65f00c3d6f60ab967bb5bf00c52e4ebff5c60fe7 — Evan Tann 1 year, 2 months ago 1e6403e
add HTTPClient interface
1 files changed, 6 insertions(+), 2 deletions(-)

M lanhttp.go
M lanhttp.go => lanhttp.go +6 -2
@@ 14,7 14,7 @@ import (

type Client struct {
	log    Logger
	client *http.Client
	client HTTPClient
	stop   chan struct{}

	// backends that are currently live


@@ 24,6 24,10 @@ type Client struct {
	mu sync.RWMutex
}

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Logger interface {
	Printf(string, ...interface{})
}


@@ 37,7 41,7 @@ type backend struct {
	Index int
}

func New(client *http.Client, lg Logger) *Client {
func New(client HTTPClient, lg Logger) *Client {
	return &Client{
		log:      lg,
		client:   client,