mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
1.return status code http.StatusNoContent in deleting network when successful
2.modify docker_api_network_test.go 3.modify docker_remote_api_v1.23.md Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
160abfbeea
commit
94c929099f
3 changed files with 13 additions and 6 deletions
|
@ -147,7 +147,14 @@ func (n *networkRouter) postNetworkDisconnect(ctx context.Context, w http.Respon
|
|||
}
|
||||
|
||||
func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
return n.backend.DeleteNetwork(vars["id"])
|
||||
if err := httputils.ParseForm(r); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := n.backend.DeleteNetwork(vars["id"]); err != nil {
|
||||
return err
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource {
|
||||
|
|
|
@ -3097,7 +3097,7 @@ JSON Parameters:
|
|||
|
||||
`POST /networks/(id)/connect`
|
||||
|
||||
Connects a container to a network
|
||||
Connect a container to a network
|
||||
|
||||
**Example request**:
|
||||
|
||||
|
@ -3134,7 +3134,7 @@ JSON Parameters:
|
|||
|
||||
`POST /networks/(id)/disconnect`
|
||||
|
||||
Disconnects a container from a network
|
||||
Disconnect a container from a network
|
||||
|
||||
**Example request**:
|
||||
|
||||
|
@ -3175,11 +3175,11 @@ Instruct the driver to remove the network (`id`).
|
|||
|
||||
**Example response**:
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
HTTP/1.1 204 No Content
|
||||
|
||||
Status Codes
|
||||
|
||||
- **200** - no error
|
||||
- **204** - no error
|
||||
- **404** - no such network
|
||||
- **500** - server error
|
||||
|
||||
|
|
|
@ -332,6 +332,6 @@ func deleteNetwork(c *check.C, id string, shouldSucceed bool) {
|
|||
c.Assert(status, checker.Not(checker.Equals), http.StatusOK)
|
||||
return
|
||||
}
|
||||
c.Assert(status, checker.Equals, http.StatusOK)
|
||||
c.Assert(status, checker.Equals, http.StatusNoContent)
|
||||
c.Assert(err, checker.IsNil)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue