http

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resp

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

Resp http response

func (*Resp) GetContent

func (r *Resp) GetContent() []byte

GetContent 返回response的[]byte格式内容

func (*Resp) GetHeader

func (r *Resp) GetHeader() h.Header

GetHeader 返回resp的header

func (*Resp) GetStatusCode

func (r *Resp) GetStatusCode() int

GetStatusCode 返回response的http code

type Response

type Response interface {
	GetHeader() h.Header
	GetContent() []byte
	GetStatusCode() int
}

Response define Response interface

func Delete

func Delete(uri string, header map[string]string, body io.Reader) (response Response, err error)

Delete will Delete数据 uri: post到的地址 header: header 请求体的header map,例如Content-Type:application/json body: post的数据

func Get

func Get(uri string) (response Response, e error)

Get 获取url对应的文件内容 header: header 请求体的header map,例如Content-Type:application/json 返回到content中

func Post

func Post(uri string, header map[string]string, body io.Reader) (response Response, err error)

Post will post数据 uri: post到的地址 header: header 请求体的header map,例如Content-Type:application/json body: post的数据

func PostForm

func PostForm(uri string, data url.Values) (response Response, err error)

PostForm will post form数据 uri: post到的地址 body: form数据

func Put

func Put(uri string, header map[string]string, body io.Reader) (response Response, err error)

Put will put数据 uri: post到的地址 header: header 请求体的header map,例如Content-Type:application/json body: post的数据

Jump to

Keyboard shortcuts

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