http

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Zlib Imports: 13 Imported by: 19

Documentation

Index

Constants

View Source
const (
	KContentType        = "Content-Type"
	KContentDisposition = "Content-Disposition"
)

Variables

View Source
var (
	FormType = reflect.TypeOf((*Form)(nil)).Elem()
)

Functions

func ConvertTo added in v1.1.32

func ConvertTo(data interface{}) url.Values

func Download added in v1.1.31

func Download(url string, filename string, perm os.FileMode) error

func Upload added in v1.1.31

func Upload(url string, filename string, headerFunc HeaderFunc) ([]byte, error)

func UploadV2 added in v1.1.31

func UploadV2(url string, form Form, headerFunc HeaderFunc) ([]byte, error)

Types

type FileForm added in v1.1.31

type FileForm struct {
	Field string
	Value string
}

func (*FileForm) CreateForm added in v1.1.31

func (df *FileForm) CreateForm(w *multipart.Writer) error

type Form added in v1.1.31

type Form interface {
	CreateForm(w *multipart.Writer) error
}

type HeaderFunc added in v0.5.0

type HeaderFunc func(h *http.Header)

type Http

type Http struct {
	DisableLog         bool
	TimeOut            int64
	HttpStatus         int
	ContentDisposition string
	ContentType        string
	ContentLength      int64
}

func (*Http) Do

func (hp *Http) Do(method string, url string, body io.Reader, headerFunc HeaderFunc) ([]byte, error)

func (*Http) DoBytes

func (hp *Http) DoBytes(method string, url string, buf []byte) ([]byte, error)

func (*Http) DoForm added in v0.2.6

func (hp *Http) DoForm(url string) ([]byte, error)

DoForm url http://api.xxx.com/ssddd?key=ddd&ddd=sfsf

func (*Http) DoFormWith added in v0.2.6

func (hp *Http) DoFormWith(url, query string) ([]byte, error)

DoFormWith query ssddd=sdsfs&sfssfs=sfsssfs&sfsfsfs&

func (*Http) DoFormWithValues added in v0.2.6

func (hp *Http) DoFormWithValues(url string, values url2.Values) ([]byte, error)

func (*Http) DoMultiForm added in v0.2.6

func (hp *Http) DoMultiForm(method, url string) ([]byte, error)

func (*Http) DoMultiFormWith added in v0.2.6

func (hp *Http) DoMultiFormWith(method, url, query string) ([]byte, error)

func (*Http) DoMultiFormWithValues added in v0.2.6

func (hp *Http) DoMultiFormWithValues(method, url string, form url2.Values) ([]byte, error)

func (*Http) DoString

func (hp *Http) DoString(method string, url string, buf []byte) (string, error)

func (*Http) DoWithHead

func (hp *Http) DoWithHead(method string, url string, buf []byte, headerFunc HeaderFunc) ([]byte, error)

func (*Http) FileName

func (hp *Http) FileName() string

func (*Http) GetContentType

func (hp *Http) GetContentType() string

func (*Http) IsFile

func (hp *Http) IsFile() bool

type ReadForm added in v1.1.31

type ReadForm struct {
	Field string
	Value string
	R     io.Reader
}

func (*ReadForm) CreateForm added in v1.1.31

func (df *ReadForm) CreateForm(w *multipart.Writer) error

type Url added in v1.1.36

type Url struct {
	url.Values
}

func NewUrl added in v1.1.36

func NewUrl() Url

func (Url) Generate added in v1.1.36

func (u Url) Generate(url, suffix string) string

func (Url) Parse added in v1.1.36

func (u Url) Parse(data interface{})

Jump to

Keyboard shortcuts

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