Merge pull request #24634 from thaJeztah/make-network-name-required

API return network-list if no network-name or id is provided
This commit is contained in:
Vincent Demeester 2016-09-27 10:20:38 +02:00 committed by GitHub
commit b826bebda0
3 changed files with 6 additions and 1 deletions

View file

@ -31,7 +31,8 @@ func (r *networkRouter) initRoutes() {
r.routes = []router.Route{
// GET
router.NewGetRoute("/networks", r.getNetworksList),
router.NewGetRoute("/networks/{id:.*}", r.getNetwork),
router.NewGetRoute("/networks/", r.getNetworksList),
router.NewGetRoute("/networks/{id:.+}", r.getNetwork),
// POST
router.NewPostRoute("/networks/create", r.postNetworkCreate),
router.NewPostRoute("/networks/{id:.*}/connect", r.postNetworkConnect),

View file

@ -59,6 +59,7 @@ func (daemon *Daemon) GetNetworkByID(partialID string) (libnetwork.Network, erro
}
// GetNetworkByName function returns a network for a given network name.
// If no network name is given, the default network is returned.
func (daemon *Daemon) GetNetworkByName(name string) (libnetwork.Network, error) {
c := daemon.netController
if c == nil {

View file

@ -125,6 +125,9 @@ This section lists each version from latest to oldest. Each listing includes a
* `POST /containers/create` now takes a `Mounts` field in `HostConfig` which replaces `Binds` and `Volumes`. *note*: `Binds` and `Volumes` are still available but are exclusive with `Mounts`
* `POST /build` now performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. Note that this change is _unversioned_ and applied to all API versions.
* `POST /build` accepts `cachefrom` parameter to specify images used for build cache.
* `GET /networks/` endpoint now correctly returns a list of *all* networks,
instead of the default network if a trailing slash is provided, but no `name`
or `id`.
### v1.24 API changes