summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/api/handlers/libpod/networks.go2
-rw-r--r--pkg/api/handlers/libpod/swagger.go2
-rw-r--r--pkg/bindings/network/network.go3
-rw-r--r--test/apiv2/35-networks.at4
4 files changed, 8 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index a6c4f6d64..48cd37994 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -128,7 +128,7 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
- utils.WriteResponse(w, http.StatusOK, reports)
+ utils.WriteResponse(w, http.StatusOK, reports[0])
}
// Connect adds a container to a network
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index 1bececa1a..2631f19ac 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -102,7 +102,7 @@ type swagNetworkRmReport struct {
// swagger:response NetworkInspectReport
type swagNetworkInspectReport struct {
// in:body
- Body []entities.NetworkInspectReport
+ Body entities.NetworkInspectReport
}
// Network list
diff --git a/pkg/bindings/network/network.go b/pkg/bindings/network/network.go
index 46a3719fe..6f3aa8594 100644
--- a/pkg/bindings/network/network.go
+++ b/pkg/bindings/network/network.go
@@ -40,6 +40,7 @@ func Create(ctx context.Context, options *CreateOptions) (*entities.NetworkCreat
// Inspect returns low level information about a CNI network configuration
func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) ([]entities.NetworkInspectReport, error) {
var reports []entities.NetworkInspectReport
+ reports = append(reports, entities.NetworkInspectReport{})
if options == nil {
options = new(InspectOptions)
}
@@ -52,7 +53,7 @@ func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) ([]e
if err != nil {
return nil, err
}
- return reports, response.Process(&reports)
+ return reports, response.Process(&reports[0])
}
// Remove deletes a defined CNI network configuration by name. The optional force boolean
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at
index d3bbaf32b..93a9c9fe4 100644
--- a/test/apiv2/35-networks.at
+++ b/test/apiv2/35-networks.at
@@ -27,6 +27,10 @@ t GET libpod/networks/json?filters='{"name":["network1"]}' 200 \
.[0].Name=network1
t GET networks 200
+#inspect network
+t GET libpod/networks/network1/json 200 \
+ .name="network1"
+
#network list docker endpoint
t GET networks?filters='{"name":["network1","network2"]}' 200 \
length=2