GetPullRequestDiff: add PullRequestDiffOptions param #542

Merged
6543 merged 9 commits from noerw/go-sdk:add-binary-diff-opt into master 2022-01-13 17:30:39 +00:00
Showing only changes of commit c8f8179c85 - Show all commits

View File

@ -6,6 +6,7 @@
package gitea
import (
"bytes"
"context"
"encoding/json"
"errors"
@ -192,7 +193,13 @@ func (c *Client) doRequest(method, path string, header http.Header, body io.Read
c.mutex.RLock()
debug := c.debug
if debug {
fmt.Printf("%s: %s\nHeader: %v\nBody: %s\n", method, c.url+"/api/v1"+path, header, body)
var bodyStr string
if body != nil {
bs, _ := ioutil.ReadAll(body)
body = bytes.NewReader(bs)
bodyStr = string(bs)
}
fmt.Printf("%s: %s\nHeader: %v\nBody: %s\n", method, c.url+"/api/v1"+path, header, bodyStr)
}
req, err := http.NewRequestWithContext(c.ctx, method, c.url+"/api/v1"+path, body)
if err != nil {