httpclient

package
v0.0.0-...-82b3d29 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package httpclient http 客户端

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestOption

type RequestOption struct {
	// Timeout 超时
	Timeout time.Duration
	// Header 请求Header
	Header http.Header
	// Body 请求Body
	Body io.Reader
	// 自动执行重定向
	AutoRedirect bool
}

RequestOption 请求可选项

type ResponseWrapper

type ResponseWrapper struct {
	// StatusCode 响应码
	StatusCode int
	// Body 响应Body
	Body []byte
	// Header 响应Header
	Header http.Header
}

ResponseWrapper 响应包装

func Get

func Get(url string, opt *RequestOption) (*ResponseWrapper, error)

Get 执行Get请求

func PostJSON

func PostJSON(url string, opt *RequestOption) (*ResponseWrapper, error)

PostJSON POST请求,发送JSON格式数据

func PostParams

func PostParams(url string, opt *RequestOption) (*ResponseWrapper, error)

PostParams POST请求按key value传递参数

Jump to

Keyboard shortcuts

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