mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #5569 from vieux/add__ping_to_the_API
Add ping to the api
This commit is contained in:
commit
f369278725
3 changed files with 34 additions and 1 deletions
|
@ -3,7 +3,6 @@ package server
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"code.google.com/p/go.net/websocket"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
|
@ -21,6 +20,8 @@ import (
|
|||
"strings"
|
||||
"syscall"
|
||||
|
||||
"code.google.com/p/go.net/websocket"
|
||||
|
||||
"github.com/dotcloud/docker/api"
|
||||
"github.com/dotcloud/docker/engine"
|
||||
"github.com/dotcloud/docker/pkg/listenbuffer"
|
||||
|
@ -976,6 +977,11 @@ func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
||||
}
|
||||
|
||||
func ping(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
_, err := w.Write([]byte{'O', 'K'})
|
||||
return err
|
||||
}
|
||||
|
||||
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, enableCors bool, dockerVersion version.Version) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// log the request
|
||||
|
@ -1044,6 +1050,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
|
|||
}
|
||||
m := map[string]map[string]HttpApiFunc{
|
||||
"GET": {
|
||||
"/_ping": ping,
|
||||
"/events": getEvents,
|
||||
"/info": getInfo,
|
||||
"/version": getVersion,
|
||||
|
|
|
@ -36,6 +36,11 @@ You can still call an old version of the api using
|
|||
|
||||
### What's new
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
**New!**
|
||||
You can now ping the server via the `_ping` endpoint.
|
||||
|
||||
`GET /events`
|
||||
|
||||
**New!**
|
||||
|
|
|
@ -1162,6 +1162,27 @@ Show the docker version information
|
|||
- **200** – no error
|
||||
- **500** – server error
|
||||
|
||||
### Ping the docker server
|
||||
|
||||
`GET /_ping`
|
||||
|
||||
Ping the docker server
|
||||
|
||||
**Example request**:
|
||||
|
||||
GET /_ping HTTP/1.1
|
||||
|
||||
**Example response**:
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
|
||||
OK
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - no error
|
||||
- **500** - server error
|
||||
|
||||
### Create a new image from a container's changes
|
||||
|
||||
`POST /commit`
|
||||
|
|
Loading…
Reference in a new issue