Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertTimeAgoString ¶
func FormatHTTPError ¶ added in v0.19.0
FormatHTTPError reads a non-2xx HTTP response and returns an error that preserves whatever the server actually said.
The Zeabur API returns JSON bodies of the form
{"code": "REQUIRE_PAID_PLAN", "error": "Upload size ... exceeds ..."}
for client-visible failures. When that shape is present, the message and (if available) code are surfaced. Otherwise the raw body is included so the user still has something to act on instead of a bare status code.
action is a short verb phrase describing what failed, e.g. "create upload session".
func UploadTimeout ¶ added in v0.19.0
UploadTimeout returns how long an upload of contentLength bytes is allowed to take: a 2-minute floor plus one second per 256 KiB of payload.
http.Client.Timeout covers the entire request including body transfer, so a fixed timeout makes large uploads fail on slow links no matter how patient the user is. The 256 KiB/s floor is deliberately conservative (~2 Mbps); a 50 MiB zip gets ~5.3 minutes.
func ValidateTemplate ¶
Types ¶
This section is empty.