diff --git a/gateway/metrics/exporter.go b/gateway/metrics/exporter.go index 9ae1a5507..438401618 100644 --- a/gateway/metrics/exporter.go +++ b/gateway/metrics/exporter.go @@ -167,7 +167,9 @@ func (e *Exporter) getFunctions(endpointURL url.URL, namespace string) ([]types. } else { body = b } - } else { + } + + if len(body) == 0 { return services, fmt.Errorf("no response body from /system/functions") } @@ -211,6 +213,10 @@ func (e *Exporter) getNamespaces(endpointURL url.URL) ([]string, error) { } } + if len(body) == 0 { + return namespaces, fmt.Errorf("no response body from /system/namespaces") + } + if err := json.Unmarshal(body, &namespaces); err != nil { return namespaces, fmt.Errorf("error unmarshalling response: %s, error: %s", string(body), err) }