示例#1
0
// Client is exported for testing subpackages
func Client(resp string) (*clients.Client, *httptest.Server) {
	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w, resp)
	})
	server := httptest.NewServer(handler)
	client, _ := clients.NewClient(&clients.Connection{Host: "localhost", Port: 8000, Username: "******", Password: "******", AuthenticationType: clients.BasicAuth})
	client.SetBase(server.URL)
	return client, server
}
示例#2
0
// Client is exported for testing subpackages
func Client(resp string) (*clients.Client, *httptest.Server) {
	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintln(w, resp)
	})
	server := httptest.NewServer(handler)
	client, _ := clients.NewClient("localhost", 8000, "admin", "admin", clients.BasicAuth)
	client.SetBase(server.URL)
	return client, server
}
示例#3
0
// NewClient creates the Client struct used for searching, etc.
func NewClient(host string, port int64, username string, password string, authType int) (*Client, error) {
	client, err := clients.NewClient(&clients.Connection{Host: host, Port: port, Username: username, Password: password, AuthenticationType: authType})
	return convertToClient(client), err
}
示例#4
0
// NewClient creates the Client struct used for searching, etc.
func NewClient(host string, port int64, username string, password string, authType int) (*Client, error) {
	client, err := clients.NewClient(host, port, username, password, authType)
	return convertToClient(client), err
}