func appIsAvailable(w http.ResponseWriter, r *http.Request, t *auth.Token) error { app := app.App{Name: r.URL.Query().Get(":appname")} err := app.Get() if err != nil { return err } if !app.Available() { return fmt.Errorf("App must be available to receive pushs.") } w.WriteHeader(http.StatusOK) return nil }