Documentation ¶
Index ¶
Constants ¶
const ( HeaderIfNoneMatch = "If-None-Match" HeaderEtag = "Etag" )
HeaderIfNoneMatch is the name of the header the client should set if they wish to only download the file if it has been modified since the provided hash. HeaderEtag is set by the server to the hash of the downloaded file.
const DefaultMaxUploadSize = 10 << 20
DefaultMaxUploadSize defines the maximum number of bytes an uploaded file can be.
Variables ¶
var ( ErrInvalidFileName = errors.NewHTTP("invalid file name provided", http.StatusBadRequest) ErrInvalidFileContent = errors.NewHTTP("invalid file content provided", http.StatusBadRequest) ErrFileNotModified = errors.NewHTTP("file has not been modified", http.StatusNotModified) ErrFileNotFound = errors.NewHTTP("file not found", http.StatusNotFound) )
ErrInvalidFileName occurs when an invalid file name is provided to the API. ErrInvalidFileContent occurs when an upload is attempted with invalid file content. ErrFileNotModified occurs when a download is attempted using the If-None-Match header and the file has not been modified. ErrFileNotFound occurs when a download is attempted for a file that does not exist.
Functions ¶
func NewDownloadHandler ¶
NewDownloadHandler returns an HTTP handler responsible for downloading a file from the CDN.
Types ¶
This section is empty.