mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 09:54:24 +01:00
Implement Get method on Client struct
This commit is contained in:
parent
56d11bbff4
commit
61afc65377
|
@ -117,7 +117,17 @@ func (c *Client) NewRequest(method string, b []byte, to string) (req *http.Reque
|
||||||
// Post function
|
// Post function
|
||||||
func (c *Client) Post(b []byte, to string) (resp *http.Response, err error) {
|
func (c *Client) Post(b []byte, to string) (resp *http.Response, err error) {
|
||||||
var req *http.Request
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
resp, err = c.client.Do(req)
|
resp, err = c.client.Do(req)
|
||||||
|
|
Loading…
Reference in a new issue