Categorygithub.com/wms3001/http
modulepackage
1.0.1
Repository: https://github.com/wms3001/http.git
Documentation: pkg.go.dev

# README

golang http 请求封装

简介

实现http请求

使用

go get github.com/wms3001/http

实例

  1. get
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token", //url
    "", // username
    "", //password
    m,  //header
    a,  //accept
    "", //body
    10, //timeout
    "", //type
    []byte{}, //file
}
resp := hp.Get()
  1. post
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Post()
  1. delete
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Delete()
  1. head
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Head()
  1. options
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Options()
  1. put
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Put()
  1. trace
m := map[string]string{
    "name":    "backy",
    "species": "dog",
}
a := map[string]string{
    "Accept": "application/json",
    //"Accept": "text/plain",
}
hp := Http{
    "https://www.wishpost.cn/api/v3/oauth/access_token",
    "",
    "",
    m,
    a,
    "",
    10,
    "",
    []byte{},
}
resp := hp.Trace()

# Structs

No description provided by the author