Browse code

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>

allencloud authored on 2016/03/06 01:41:51
Showing 3 changed files
... ...
@@ -147,7 +147,14 @@ func (n *networkRouter) postNetworkDisconnect(ctx context.Context, w http.Respon
147 147
 }
148 148
 
149 149
 func (n *networkRouter) deleteNetwork(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
150
-	return n.backend.DeleteNetwork(vars["id"])
150
+	if err := httputils.ParseForm(r); err != nil {
151
+		return err
152
+	}
153
+	if err := n.backend.DeleteNetwork(vars["id"]); err != nil {
154
+		return err
155
+	}
156
+	w.WriteHeader(http.StatusNoContent)
157
+	return nil
151 158
 }
152 159
 
153 160
 func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource {
... ...
@@ -3097,7 +3097,7 @@ JSON Parameters:
3097 3097
 
3098 3098
 `POST /networks/(id)/connect`
3099 3099
 
3100
-Connects a container to a network
3100
+Connect a container to a network
3101 3101
 
3102 3102
 **Example request**:
3103 3103
 
... ...
@@ -3134,7 +3134,7 @@ JSON Parameters:
3134 3134
 
3135 3135
 `POST /networks/(id)/disconnect`
3136 3136
 
3137
-Disconnects a container from a network
3137
+Disconnect a container from a network
3138 3138
 
3139 3139
 **Example request**:
3140 3140
 
... ...
@@ -3175,11 +3175,11 @@ Instruct the driver to remove the network (`id`).
3175 3175
 
3176 3176
 **Example response**:
3177 3177
 
3178
-    HTTP/1.1 200 OK
3178
+    HTTP/1.1 204 No Content
3179 3179
 
3180 3180
 Status Codes
3181 3181
 
3182
--   **200** - no error
3182
+-   **204** - no error
3183 3183
 -   **404** - no such network
3184 3184
 -   **500** - server error
3185 3185
 
... ...
@@ -332,6 +332,6 @@ func deleteNetwork(c *check.C, id string, shouldSucceed bool) {
332 332
 		c.Assert(status, checker.Not(checker.Equals), http.StatusOK)
333 333
 		return
334 334
 	}
335
-	c.Assert(status, checker.Equals, http.StatusOK)
335
+	c.Assert(status, checker.Equals, http.StatusNoContent)
336 336
 	c.Assert(err, checker.IsNil)
337 337
 }