net

package
v0.0.0-...-f5db4f3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Net

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

Net 请求结构体

func New

func New() *Net

New 初始化一个请求包对象

func NewWithClient

func NewWithClient(client *http.Client) *Net

NewWithClient 初始化一个请求包对象,自己传入Client

func (*Net) Delete

func (n *Net) Delete(url string) *SuperAgent

Delete 发送 Delete 请求

func (*Net) Get

func (n *Net) Get(url string) *SuperAgent

Get 发送 Get 请求

func (*Net) GetClient

func (n *Net) GetClient() *http.Client

GetClient 获取http client

func (*Net) Post

func (n *Net) Post(url string) *SuperAgent

Post 发送 Post 请求

func (*Net) Put

func (n *Net) Put(url string) *SuperAgent

Put 发送 Put 请求

type SuperAgent

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

SuperAgent 请求参数

func (*SuperAgent) End

func (s *SuperAgent) End(ctx context.Context, v interface{}) (*http.Response, error)

End 开始http请求

func (*SuperAgent) Header

func (s *SuperAgent) Header(header map[string]string) *SuperAgent

Header 设置请求头内容

func (*SuperAgent) JSON

func (s *SuperAgent) JSON(body interface{}) *SuperAgent

JSON 设置请求数据内容,默认用 Content-Type=application/json; 方式发送json数据

func (*SuperAgent) Text

func (s *SuperAgent) Text(body string) *SuperAgent

Text 设置请求数据内容,默认用 Content-Type=text/plain; 方式发送string数据

func (*SuperAgent) XML

func (s *SuperAgent) XML(body interface{}) *SuperAgent

XML 设置请求数据内容,默认用 Content-Type=application/json; 方式发送json数据

Jump to

Keyboard shortcuts

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