formdata

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType int
const (
	NoneType DataType = iota
	ParamType
	FileType
)

type Multipart

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

Multipart provides a streaming multipart/form-data builder for HTTP requests.

func NewMultipart

func NewMultipart(ctx context.Context, client *http.Client, method, url string) *Multipart

NewMultipart creates a new streaming multipart/form-data request builder.

func (*Multipart) Bool

func (r *Multipart) Bool(key string, value bool) *Multipart

Bool adds a boolean field to the multipart form.

func (*Multipart) File

func (r *Multipart) File(key, filename string, content io.Reader) *Multipart

File adds a file field to the multipart form.

func (*Multipart) Float

func (r *Multipart) Float(key string, value float64) *Multipart

Float adds a float64 field to the multipart form.

func (*Multipart) Header

func (r *Multipart) Header(key, value string) *Multipart

Header sets an HTTP header on the request.

func (*Multipart) Int

func (r *Multipart) Int(key string, value int) *Multipart

Int adds an integer field to the multipart form.

func (*Multipart) Param

func (r *Multipart) Param(key, value string) *Multipart

Param adds a string field to the multipart form.

func (*Multipart) PathBool

func (r *Multipart) PathBool(key string, value bool) *Multipart

PathBool replaces a path variable placeholder with a boolean value.

func (*Multipart) PathFloat

func (r *Multipart) PathFloat(key string, value float64) *Multipart

PathFloat replaces a path variable placeholder with a float64 value.

func (*Multipart) PathInt

func (r *Multipart) PathInt(key string, value int) *Multipart

PathInt replaces a path variable placeholder with an integer value.

func (*Multipart) PathParam

func (r *Multipart) PathParam(key, value string) *Multipart

PathParam replaces a path variable placeholder in the URL. Replaces {key} with the provided value. Example: "/users/{id}" with PathParam("id", "123") becomes "/users/123"

func (*Multipart) Send

func (r *Multipart) Send() (*http.Response, error)

Send executes the HTTP request and returns the response.

func (*Multipart) Timeout

func (r *Multipart) Timeout(duration time.Duration) *Multipart

Timeout sets a timeout for the request.

Jump to

Keyboard shortcuts

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