@@ -64,13 +64,19 @@ func NewServer(store *store.Store, authorization string) (server *Server, err er
6464 })
6565 })
6666
67- // GET /api/manifests
68- r .HandleFunc ("/api/manifests" , func (w http.ResponseWriter , r * http.Request ) {
67+ // GET /api/manifests/{id}
68+ r .HandleFunc ("/api/manifests/{id} " , func (w http.ResponseWriter , r * http.Request ) {
6969 if authorization != r .Header .Get ("Authorization" ) {
7070 http .Error (w , "Forbidden" , http .StatusForbidden )
7171 return
7272 }
7373
74+ vars := mux .Vars (r )
75+ m := store .Find (vars ["id" ])
76+ if m == nil {
77+ http .Error (w , "not found" , http .StatusNotFound )
78+ return
79+ }
7480 var b []byte
7581 if strings .Contains (r .Header .Get ("Accept" ), "application/json" ) {
7682 w .Header ().Set ("Content-Type" , "applications/json" )
@@ -83,19 +89,13 @@ func NewServer(store *store.Store, authorization string) (server *Server, err er
8389 w .Write (b )
8490 }).Methods ("GET" )
8591
86- // GET /api/manifests/{id}
87- r .HandleFunc ("/api/manifests/{id} " , func (w http.ResponseWriter , r * http.Request ) {
92+ // GET /api/manifests
93+ r .HandleFunc ("/api/manifests" , func (w http.ResponseWriter , r * http.Request ) {
8894 if authorization != r .Header .Get ("Authorization" ) {
8995 http .Error (w , "Forbidden" , http .StatusForbidden )
9096 return
9197 }
9298
93- vars := mux .Vars (r )
94- m := store .Find (vars ["id" ])
95- if m == nil {
96- http .Error (w , "not found" , http .StatusNotFound )
97- return
98- }
9999 var b []byte
100100 if strings .Contains (r .Header .Get ("Accept" ), "application/json" ) {
101101 w .Header ().Set ("Content-Type" , "applications/json" )
0 commit comments