Separate API router from server.

Implement basic interfaces to write custom routers that can be plugged
to the server. Remove server coupling with the daemon.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: da982cf5511814b6897244ecaa9c016f8800340a
Component: engine
This commit is contained in:
David Calavera
2015-09-23 19:42:08 -04:00
parent e5db2c0e2f
commit 1fb74bb17c
32 changed files with 809 additions and 591 deletions

View File

@ -5,6 +5,8 @@ import (
"net/http/httptest"
"testing"
"github.com/docker/docker/api/server/httputils"
"golang.org/x/net/context"
)
@ -19,7 +21,7 @@ func TestMiddlewares(t *testing.T) {
ctx := context.Background()
localHandler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if versionFromContext(ctx) == "" {
if httputils.VersionFromContext(ctx) == "" {
t.Fatalf("Expected version, got empty string")
}
return nil