func New(ctx context.Context, dsn string) (*Client, error) {
	dsnURL, err := url.Parse(dsn)
	if err != nil {
		return nil, err
	}
	user := dsnURL.User
	dsnURL.User = nil
	c := &Client{
		Client: &http.Client{},
		dsn:    dsnURL,
		rawDSN: dsn,
	}
	if user != nil {
		password, _ := user.Password()
		if err := c.defaultAuth(ctx, user.Username(), password); err != nil {
			return nil, err
		}
	}
	return c, nil
}
// New returns a connection to a remote CouchDB server. If credentials are
// included in the URL, CookieAuth is attempted first, with BasicAuth used as
// a fallback. If both fail, an error is returned. If you wish to use some other
// authentication mechanism, do not specify credentials in the URL, and instead
// call the Auth() method later.
New returns a connection to a remote CouchDB server. If credentials are
included in the URL, CookieAuth is attempted first, with BasicAuth used as
a fallback. If both fail, an error is returned. If you wish to use some other
authentication mechanism, do not specify credentials in the URL, and instead
call the Auth() method later.
// New returns a connection to a remote CouchDB server . If credentials are // included in the URL CookieAuth is attempted first with BasicAuth used as // a fallback . If both fail an error is returned . If you wish to use some other // authentication mechanism do not specify credentials in the URL and instead // call the Auth () method later .
func New(ctx context.Context, dsn string) (*Client, error) {
	dsnURL, err := url.Parse(dsn)
	if err != nil {
		return nil, err
	}
	user := dsnURL.User
	dsnURL.User = nil
	c := &Client{
		Client: &http.Client{},
		dsn:    dsnURL,
		rawDSN: dsn,
	}
	if user != nil {
		password, _ := user.Password()
		if err := c.defaultAuth(ctx, user.Username(), password); err != nil {
			return nil, err
		}
	}
	return c, nil
}
func New ( ctx context . Context , dsn string ) ( * Client , error ) { dsnURL , err := url . Parse ( dsn ) if err != nil { return nil , err } user := dsnURL . User dsnURL . User = nil c := & Client { Client : & http . Client { } , dsn : dsnURL , rawDSN : dsn , } if user != nil { password , _ := user . Password ( ) if err := c . defaultAuth ( ctx , user . Username ( ) , password ) ; err != nil { return nil , err } } return c , nil }
New returns a connection to a remote CouchDB server.
New returns a connection to a remote CouchDB server .