func NewHandler(srv Getter) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var resp response

		if err := srv.Get(r, &resp); err != nil {
			switch resp := errors.Cause(err).(type) {
			case validationErrorResponse:
				responses.BadRequest(w, resp)
			case notFoundResponse:
				responses.NotFound(w, resp)
			default:
				responses.InternalServerError(w)
			}
			return
		}

		responses.OK(w, resp)
	}
}
// NewHandler returns handler for get key requests.
NewHandler returns handler for get key requests.
// NewHandler returns handler for get key requests .
func NewHandler(srv Getter) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var resp response
		if err := srv.Get(r, &resp); err != nil {
			switch resp := errors.Cause(err).(type) {
			case validationErrorResponse:
				responses.BadRequest(w, resp)
			case notFoundResponse:
				responses.NotFound(w, resp)
			default:
				responses.InternalServerError(w)
			}
			return
		}
		responses.OK(w, resp)
	}
}
func NewHandler ( srv Getter ) http . HandlerFunc { return func ( w http . ResponseWriter , r * http . Request ) { var resp response if err := srv . Get ( r , & resp ) ; err != nil { switch resp := errors . Cause ( err ) . ( type ) { case validationErrorResponse : responses . BadRequest ( w , resp ) case notFoundResponse : responses . NotFound ( w , resp ) default : responses . InternalServerError ( w ) } return } responses . OK ( w , resp ) } }
NewHandler returns handler for get key requests.
NewHandler returns handler for get key requests .