http

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package http connects typed HTTP file inputs and responses to storage disks. Authorization and file validation remain the consuming endpoint's policies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Download

Download defers opening until the typed HTTP handler and authorization succeed. It reuses Foundry's download response, including HEAD, conditional requests, byte ranges, presentation validation and automatic reader cleanup. Seeking streams provider ranges; no complete-object buffer or temporary download file is needed. Signed HTTP endpoints can protect local downloads with the existing URL signer. Never serve a managed local store with a filesystem file server.

func ResponseError added in v0.8.0

func ResponseError(err error) error

ResponseError maps storage failures to the shared HTTP envelope. Capacity exhaustion (fault.Overloaded, LimitExceeded), disk shutdown and deadlines are retryable 503 responses, not 500s; unclassified adapter failures remain 500. Use it after an application-level storage or attachment read, inside a deferred http.StreamFrom or http.DownloadFrom source. Handle application/domain errors separately first. A nil error returns nil; unclassified errors map to InternalError. The original cause is retained.

func StoreUpload

StoreUpload persists a captured request-owned upload before the request ends. It uses the supplied key, never the client's filename. Existing HTTP upload limits, validation, bounded spooling and request cleanup remain in force. Detected media type is a default only; it is not proof of a valid file format. A successful StoredObject can be retained; UploadedFile cannot outlive requests.

func Stream

func Stream(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Stream

Stream works with any storage backend and defers opening to the response phase. It describes a finite stream with a known length; HTTP byte-range and validator negotiation require Download. WithName controls presentation, not object keys.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL