mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
Implement Get method on Client struct
This commit is contained in:
parent
56d11bbff4
commit
61afc65377
1 changed files with 11 additions and 1 deletions
|
@ -117,7 +117,17 @@ func (c *Client) NewRequest(method string, b []byte, to string) (req *http.Reque
|
|||
// Post function
|
||||
func (c *Client) Post(b []byte, to string) (resp *http.Response, err error) {
|
||||
var req *http.Request
|
||||
if req, err = c.NewRequest(b, to); err != nil {
|
||||
if req, err = c.NewRequest(http.MethodPost, b, to); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err = c.client.Do(req)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Create an http GET request with forgejo/gitea specific headers
|
||||
func (c *Client) Get(b []byte, to string) (resp *http.Response, err error) {
|
||||
var req *http.Request
|
||||
if req, err = c.NewRequest(http.MethodGet, b, to); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err = c.client.Do(req)
|
||||
|
|
Loading…
Reference in a new issue