diff --git a/holder.go b/holder.go index 052c725ad..375384271 100644 --- a/holder.go +++ b/holder.go @@ -906,13 +906,13 @@ func (h *Holder) limitedSchema() ([]*IndexInfo, error) { } func (h *Holder) schema(ctx context.Context, includeViews bool) ([]*IndexInfo, error) { - var a []*IndexInfo - schema, err := h.schemator.Schema(ctx) if err != nil { return nil, errors.Wrapf(err, "getting schema via schemator") } + a := make([]*IndexInfo, 0, len(schema)) + for _, index := range schema { cim, err := decodeCreateIndexMessage(h.serializer, index.Data) if err != nil { diff --git a/server/handler_test.go b/server/handler_test.go index 0d5ac0974..ccd3c5b03 100644 --- a/server/handler_test.go +++ b/server/handler_test.go @@ -106,7 +106,7 @@ func TestHandler_Endpoints(t *testing.T) { t.Fatalf("unexpected status code: %d", w.Code) } body := w.Body.String() - if body != "{\"indexes\":null}\n" { + if body != "{\"indexes\":[]}\n" { t.Fatalf("unexpected empty schema: '%v'", body) } @@ -119,7 +119,7 @@ func TestHandler_Endpoints(t *testing.T) { t.Fatalf("unexpected status code: %d", w.Code) } body := w.Body.String() - if body != "{\"indexes\":null}\n" { + if body != "{\"indexes\":[]}\n" { t.Fatalf("unexpected empty schema: '%v'", body) }