contents

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Multipart

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

func NewMultipart

func NewMultipart() *Multipart

Create a new multipart/form-data object

Example:

m := NewMultipart()
// Insert k-v data
err := m.Insert("key", "value")
require.NoError(t, err)
// Insert files
err := m.InsertFile("key", file)

func (*Multipart) Export

func (c *Multipart) Export() *bytes.Buffer

Outputs a multipart/form-data format.

func (*Multipart) Insert

func (c *Multipart) Insert(key string, value string) error

Add a string form

func (*Multipart) InsertFile

func (c *Multipart) InsertFile(key string, file *os.File) error

Add a file objects

Example:

file, err := os.Open("file path")
require.NoError(t, err)
m.InsertFile("file", file)

Jump to

Keyboard shortcuts

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