1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-09 12:40:24 +08:00

finish role

This commit is contained in:
源文雨
2023-10-11 00:16:44 +09:00
parent 50939b98aa
commit 4745fa990e
5 changed files with 187 additions and 0 deletions

10
http.go
View File

@@ -21,6 +21,16 @@ func NewHTTPEndpointGetRequestWithAuth(ep string, auth string) (req *http.Reques
return
}
// NewHTTPEndpointPutRequestWithAuth 新建带鉴权头的 HTTP PUT 请求
func NewHTTPEndpointPutRequestWithAuth(ep string, auth string, body io.Reader) (req *http.Request, err error) {
req, err = http.NewRequest("PUT", StandardAPI+ep, body)
if err != nil {
return
}
req.Header.Add("Authorization", auth)
return
}
// NewHTTPEndpointDeleteRequestWithAuth 新建带鉴权头的 HTTP DELETE 请求
func NewHTTPEndpointDeleteRequestWithAuth(ep string, auth string, body io.Reader) (req *http.Request, err error) {
req, err = http.NewRequest("DELETE", StandardAPI+ep, body)