multipart

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: Apache-2.0 Imports: 10 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ContentTypeForm = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder is a multipart encoder object

func NewFormEncoder added in v0.0.4

func NewFormEncoder(w io.Writer) *Encoder

NewFormEncoder creates a new encoder object, which writes application/x-www-form-urlencoded to the io.Writer

func NewMultipartEncoder added in v0.0.4

func NewMultipartEncoder(w io.Writer) *Encoder

NewMultipartEncoder creates a new encoder object, which writes multipart/form-data to the io.Writer

func (*Encoder) Close

func (enc *Encoder) Close() error

Close the writer after writing all the data

func (*Encoder) ContentType

func (enc *Encoder) ContentType() string

Return the MIME content type of the data

func (*Encoder) Encode

func (enc *Encoder) Encode(v any) error

Encode writes the struct to the multipart writer, including any File objects which are added as form data and excluding any fields with a tag of json:"-"

type File

type File struct {
	Path string
	Body io.Reader
}

File is a file object, which is used to encode a file in a multipart request

Jump to

Keyboard shortcuts

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