diff --git a/couchdb/client.go b/couchdb/client.go index 61866cbf..112c25b9 100644 --- a/couchdb/client.go +++ b/couchdb/client.go @@ -29,7 +29,7 @@ import ( ) func (c *client) AllDBs(ctx context.Context, opts driver.Options) ([]string, error) { - var query url.Values + query := url.Values{} opts.Apply(&query) var allDBs []string err := c.DoJSON(ctx, http.MethodGet, "/_all_dbs", &chttp.Options{Query: query}, &allDBs) diff --git a/couchdb/client_test.go b/couchdb/client_test.go index 216220c1..358f5a79 100644 --- a/couchdb/client_test.go +++ b/couchdb/client_test.go @@ -60,6 +60,12 @@ func TestAllDBs(t *testing.T) { }, nil), expected: []string{"_global_changes", "_replicator", "_users"}, }) + tests.Add("with param", test{ + client: newTestClient(nil, errors.New("expected")), + options: kivik.Param("startkey", "bar"), + status: http.StatusBadGateway, + err: `Get "?http://example.com/_all_dbs\?startkey=bar"?: expected`, + }) tests.Run(t, func(t *testing.T, test test) { opts := test.options