Clearer names for layer upload routes

This commit is contained in:
Stephen J Day 2014-11-10 18:26:06 -08:00
parent 7f75e6368d
commit 0618a2ebd7
2 changed files with 12 additions and 12 deletions

View file

@ -10,16 +10,16 @@ const (
routeNameImageManifest = "image-manifest"
routeNameTags = "tags"
routeNameLayer = "layer"
routeNameStartLayerUpload = "start-layer-upload"
routeNameLayerUpload = "layer-upload"
routeNameLayerUploadResume = "layer-upload-resume"
)
var allEndpoints = []string{
routeNameImageManifest,
routeNameTags,
routeNameLayer,
routeNameStartLayerUpload,
routeNameLayerUpload,
routeNameLayerUploadResume,
}
// v2APIRouter builds a gorilla router with named routes for the various API
@ -59,14 +59,14 @@ func v2APIRouter() *mux.Router {
// POST /v2/<name>/layer/<tarsum>/upload/ Layer Upload Initiate an upload of the layer identified by tarsum. Requires length and a checksum parameter.
namedRouter.
Path("/layer/{tarsum}/upload/").
Name(routeNameStartLayerUpload)
Name(routeNameLayerUpload)
// GET /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Get the status of the upload identified by tarsum and uuid.
// PUT /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Upload all or a chunk of the upload identified by tarsum and uuid.
// DELETE /v2/<name>/layer/<tarsum>/upload/<uuid> Layer Upload Cancel the upload identified by layer and uuid
namedRouter.
Path("/layer/{tarsum}/upload/{uuid}").
Name(routeNameLayerUpload)
Name(routeNameLayerUploadResume)
return router
}

View file

@ -76,7 +76,7 @@ func TestRouter(t *testing.T) {
},
},
{
routeName: routeNameStartLayerUpload,
routeName: routeNameLayerUpload,
expectedRouteInfo: routeInfo{
RequestURI: "/v2/foo/bar/layer/tarsum/upload/",
Vars: map[string]string{
@ -86,7 +86,7 @@ func TestRouter(t *testing.T) {
},
},
{
routeName: routeNameLayerUpload,
routeName: routeNameLayerUploadResume,
expectedRouteInfo: routeInfo{
RequestURI: "/v2/foo/bar/layer/tarsum/upload/uuid",
Vars: map[string]string{