Documentation ¶
Index ¶
- type Writer
- func (w *Writer) Boundary() string
- func (w *Writer) Close() error
- func (w *Writer) CreateFormField(fieldname string) (io.Writer, error)
- func (w *Writer) CreateFormFile(fieldname, filename string) (io.Writer, error)
- func (w *Writer) CreatePart(header textproto.MIMEHeader) (io.Writer, error)
- func (w *Writer) FormDataContentType() string
- func (w *Writer) SetBoundary(boundary string) error
- func (w *Writer) WriteField(fieldname, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer generates multipart messages.
func (*Writer) Close ¶
Close finishes the multipart message and writes the trailing boundary end line to the output.
func (*Writer) CreateFormField ¶
CreateFormField calls CreatePart with a header using the given field name.
func (*Writer) CreateFormFile ¶
CreateFormFile is a convenience wrapper around CreatePart. It creates a new form-data header with the provided field name and file name.
func (*Writer) CreatePart ¶
CreatePart creates a new multipart section with the provided header. The body of the part should be written to the returned Writer. After calling CreatePart, any previous part may no longer be written to.
func (*Writer) FormDataContentType ¶
FormDataContentType returns the Content-Type for an HTTP multipart/form-data with this Writer's Boundary.
func (*Writer) SetBoundary ¶
SetBoundary overrides the Writer's default randomly-generated boundary separator with an explicit value.
SetBoundary must be called before any parts are created, may only contain certain ASCII characters, and must be 1-69 bytes long.
func (*Writer) WriteField ¶
WriteField calls CreateFormField and then writes the given value.