httpclient

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 11 Imported by: 16

README

go-http-client

项目简介
  1. fasthttp 进行封装

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeURL

func EncodeURL(api string, params RequestQueries) (string, error)

EncodeURL add and encode parameters.

func GetJSON

func GetJSON(url string, response interface{}) error

func GetQuery

func GetQuery(req *http.Request, key string) string

GetQuery returns url query value

func PostForm

func PostForm(url, field, filename string, reader io.Reader, response interface{}) error

func PostFormByFile

func PostFormByFile(url, field, filename string, response interface{}) error

func PostJSON

func PostJSON(url string, params interface{}, response interface{}) error

PostJSON perform a HTTP/POST request with json body

func PostJSONWithBody

func PostJSONWithBody(url string, params interface{}) (int, []byte, error)

PostJSONWithBody return with http body.

func PostJSONWithBody2

func PostJSONWithBody2(url string, params interface{}) (*http.Response, error)

postJSONWithBody return with http body.

func RandomString

func RandomString(ln int) string

RandomString random string generator

ln length of return string

func TokenAPI

func TokenAPI(api, token string) (string, error)

TokenAPI 获取带 token 的 API 地址

Types

type RequestParams

type RequestParams map[string]interface{}

POST 参数

type RequestQueries

type RequestQueries map[string]string

URL 参数

Jump to

Keyboard shortcuts

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