Documentation
¶
Overview ¶
Package contentdisposition creates and parses HTTP Content-Disposition headers. It is a port of the npm content-disposition package using only the Go standard library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentDisposition ¶
type ContentDisposition struct {
// Type is the disposition type, e.g. "attachment" or "inline".
Type string
// Filename is the decoded filename, if any (from filename* or filename).
Filename string
// Parameters holds all disposition parameters (including "filename").
Parameters map[string]string
}
ContentDisposition represents a parsed Content-Disposition header.
func Parse ¶
func Parse(s string) (ContentDisposition, error)
Parse parses a Content-Disposition header value. If no disposition type is present the default "attachment" is used. A filename* parameter takes precedence over a plain filename parameter.
type Option ¶
type Option func(*options)
Option configures how a Content-Disposition header is formatted.
func WithFallback ¶
WithFallback controls whether an ASCII fallback filename parameter is emitted when the filename contains non-ASCII characters. It is true by default; setting it to false suppresses the plain filename parameter.