func EncodeHandler(storage storages.IStorage) http.Handler { handleFunc := func(w http.ResponseWriter, r *http.Request) { if url := r.PostFormValue("url"); url != "" { w.Write([]byte(storage.Save(url))) } } return http.HandlerFunc(handleFunc) }