request

package
v0.0.0-...-2ca8ae2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2018 License: Apache-2.0 Imports: 5 Imported by: 1

README

关于 http reqeust 的小工具集

  • Request 请求远程 url 数据
// 如果有传递的参数, 默认是用 post 方法
// 如果有需要 get 传递的参数, 请自行组装到 url 里面
func Request(url string, https bool, params ...url.Values) ([]byte, error)
  • Input 获取请求参数包含 url query string, get、post params
// 不能获取 head 及 body 中参数
func Input(r *http.Request) (url.Values, error)
  • IsMobile 是否手机客户端

  • IsWeiXin 是否微信客户端

  • Url 完整的URL

Documentation

Index

Constants

View Source
const (
	UA_MOBILE = "mobile"
	UA_WECHAT = "MicroMessenger"
)

Variables

This section is empty.

Functions

func Input

func Input(r *http.Request) (url.Values, error)

Input 获取请求参数包含 url query string, get、post params 限制,不能获取 head 及 body 中参数

func IsMobile

func IsMobile(ua string) bool

IsMobile 是否手机客户端

func IsWeiXin

func IsWeiXin(ua string) bool

IsWeiXin 是否微信客户端

func Request

func Request(url string, https bool, params ...url.Values) ([]byte, error)

Request 请求远程 url 数据 如果有传递的参数, 默认是用 post 方法 如果有需要 get 传递的参数, 请自行组装到 url 里面

func Url

func Url(r *http.Request) string

Url 获取完整的URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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