httpapi

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE_JSON       = "application/json;charset=UTF-8"
	CONTENT_TYPE_URLENCODED = "application/x-www-form-urlencoded"
	CONTENT_TYPE_FROM_DATA  = "multipart/form-data"
)

Variables

Functions

This section is empty.

Types

type GetRequest

type GetRequest struct{}

func (*GetRequest) Get

func (g *GetRequest) Get(urlPath string) (data string, err error)

Get *

  • @Description: 标准的get请求
  • @receiver h
  • @param urlPath http接口地址
  • @return data
  • @return err

func (*GetRequest) GetPro

func (g *GetRequest) GetPro(urlPath string, paramMap map[string]interface{}, headerMap map[string]interface{}, cookies []*http.Cookie) (data string, err error)

GetPro *

  • @Description: Get请求(专业版)(支持自定义header、cookie)
  • @receiver h
  • @param urlPath http接口地址
  • @param paramMap 参数map
  • @param headerMap 请求头Map
  • @param cookies cookie列表
  • @return data 返回的数据
  • @return err 错误

func (*GetRequest) GetWithParams

func (g *GetRequest) GetWithParams(urlPath string, paramMap map[string]interface{}) (data string, err error)

GetWithParams *

  • @Description: 携带Params参数的http请求
  • @receiver h
  • @param urlPath http接口地址
  • @param paramMap 参数map
  • @return data 返回的数据
  • @return err

type PostRequest

type PostRequest struct{}

func (*PostRequest) PostFormData

func (p *PostRequest) PostFormData(urlPath string, bodyMap map[string]interface{}) (data string, err error)

PostFormData *

  • @Description: POST请求(multipart/form-data)
  • @receiver p
  • @param urlPath
  • @param bodyMap
  • @return data
  • @return err

func (*PostRequest) PostJson

func (p *PostRequest) PostJson(urlPath string, bodyMap map[string]interface{}) (data string, err error)

PostJson *

  • @Description: POST请求(application/json)
  • @receiver p
  • @param urlPath
  • @param bodyMap
  • @return data
  • @return err

func (*PostRequest) PostPro

func (p *PostRequest) PostPro(urlPath, contentType string, bodyMap map[string]interface{}, headerMap map[string]interface{}, cookies []*http.Cookie) (data string, err error)

PostPro *

  • @Description: Post请求(专业版)(支持自定义header、cookie)
  • @receiver p
  • @param urlPath http接口地址
  • @param contentType Content-Type
  • @param paramMap 参数map
  • @param headerMap 请求头Map
  • @param cookies cookie列表
  • @return data 返回的数据
  • @return err 错误

func (*PostRequest) PostUrlencoded

func (p *PostRequest) PostUrlencoded(urlPath string, bodyMap map[string]interface{}) (data string, err error)

PostUrlencoded *

  • @Description: POST请求(浏览器默认表单格式)(application/x-www-form-urlencoded)
  • @receiver p
  • @param urlPath http接口地址
  • @param bodyMap 参数map
  • @return data
  • @return err

Jump to

Keyboard shortcuts

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