You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: idempotent-by-name note no longer misleads free-tier users (#9)
The idempotent path's note said
"Delete it via DELETE /api/me/resources/{token} to provision a
new one with this name"
but handleDeleteResource is paid-tier only — free users hitting
DELETE get 403 paid_tier_only. Advertising an endpoint the caller
can't use is a worse UX than not advertising one.
Branch on existing.tier:
- paid: keep the DELETE instruction (correct, they can use it)
- non-paid: point them at /pricing.html with a note about the 24h
auto-expiry as the actual free-tier lifecycle.
Same change in handleNewDB and handleNewWebhook.
"note": fmt.Sprintf("Returning your existing %q database. Delete it via DELETE /api/me/resources/%s to provision a new one with this name.", name, existing.token),
// paid_tier_only), so don't suggest it on the free-tier path —
95
+
// that would send them to an endpoint they can't use. Steer them
96
+
// to upgrade instead.
97
+
ifexisting.tier=="paid" {
98
+
resp["note"] =fmt.Sprintf("Returning your existing %q database. Delete it via DELETE /api/me/resources/%s to provision a new one with this name.", name, existing.token)
99
+
} else {
100
+
resp["note"] =fmt.Sprintf("Returning your existing %q database. Free-tier resources auto-expire in 24h; upgrade to Developer for manual delete + re-provision: %s/pricing.html", name, s.marketingURL)
93
101
}
94
102
ifexisting.expiresAt.Valid {
95
103
resp["expires_at"] =existing.expiresAt.Time
@@ -252,7 +260,13 @@ func (s *server) handleNewWebhook(w http.ResponseWriter, r *http.Request) {
"note": fmt.Sprintf("Returning your existing %q webhook. Delete it via DELETE /api/me/resources/%s to provision a new one with this name.", name, existing.token),
263
+
}
264
+
// Same caveat as handleNewDB: don't point free-tier users at a
265
+
// DELETE endpoint they'd 403 on.
266
+
ifexisting.tier=="paid" {
267
+
resp["note"] =fmt.Sprintf("Returning your existing %q webhook. Delete it via DELETE /api/me/resources/%s to provision a new one with this name.", name, existing.token)
268
+
} else {
269
+
resp["note"] =fmt.Sprintf("Returning your existing %q webhook. Free-tier resources auto-expire in 24h; upgrade to Developer for manual delete + re-provision: %s/pricing.html", name, s.marketingURL)
0 commit comments