func GetImageJSONV1Handler(ctx *macaron.Context, log *logs.BeeLogger) (int, []byte) { var jsonInfo string var payload string var err error imageId := ctx.Params(":imageId") i := new(models.Image) if jsonInfo, err = i.GetJSON(imageId); err != nil { log.Error("[REGISTRY API V1] Failed to get image %v json: %v", imageId, err.Error()) result, _ := json.Marshal(map[string]string{"message": "Failed to get image json"}) return http.StatusNotFound, result } if payload, err = i.GetPayload(imageId); err != nil { log.Error("[REGISTRY API V1] Failed to get image %v payload: %v", imageId, err.Error()) result, _ := json.Marshal(map[string]string{"message": "Failed to get image payload"}) return http.StatusNotFound, result } ctx.Resp.Header().Set("X-Docker-Checksum-Payload", fmt.Sprintf("sha256:%v", payload)) ctx.Resp.Header().Set("X-Docker-Size", fmt.Sprint(i.Size)) ctx.Resp.Header().Set("Content-Length", fmt.Sprint(len(jsonInfo))) return http.StatusOK, []byte(jsonInfo) }