mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
Merge pull request #9695 from jmguzik/array-inspect-network-fix
Fix array instead of one elem network http api
This commit is contained in:
@ -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
|
||||
|
@ -102,7 +102,7 @@ type swagNetworkRmReport struct {
|
||||
// swagger:response NetworkInspectReport
|
||||
type swagNetworkInspectReport struct {
|
||||
// in:body
|
||||
Body []entities.NetworkInspectReport
|
||||
Body entities.NetworkInspectReport
|
||||
}
|
||||
|
||||
// Network list
|
||||
|
@ -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
|
||||
|
@ -30,6 +30,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
|
||||
|
Reference in New Issue
Block a user