1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Fix LFS URL (#33840)

Fix #33839
This commit is contained in:
wxiaoguang
2025-03-10 17:36:02 +08:00
committed by GitHub
parent 34e5df6d30
commit c102492e5a
11 changed files with 131 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ import (
"bytes"
"context"
"crypto/tls"
"errors"
"fmt"
"io"
"net"
@@ -101,6 +102,9 @@ func (r *Request) Param(key, value string) *Request {
// Body adds request raw body. It supports string, []byte and io.Reader as body.
func (r *Request) Body(data any) *Request {
if r == nil {
return nil
}
switch t := data.(type) {
case nil: // do nothing
case string:
@@ -193,6 +197,9 @@ func (r *Request) getResponse() (*http.Response, error) {
// Response executes request client gets response manually.
// Caller MUST close the response body if no error occurs
func (r *Request) Response() (*http.Response, error) {
if r == nil {
return nil, errors.New("invalid request")
}
return r.getResponse()
}