Debian Codegraph @

lfshttp/client_test.go

raw symbols SCIP
1 package lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/
2
3 import (
4 "crypto/tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/"
5 "encoding/jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/"
6 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
7 "netscip-go gomod github.com/golang/go/src go1.25.0 net/"
8 "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/"
9 "net/http/httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/"
10 "sync/atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/"
11 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
12
13 "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/"
14 "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
15 "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/"
16 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
17 "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/"
18 )
19
20 type redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest# struct {
21 Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test. string
22 }
23
24 func TestClientRedirectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestClientRedirect().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
25 var srv3Https, srv3Http string
26
27 var called1 uint32
28 var called2 uint32
29 var called3 uint32
30 srv3 := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewTLSServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewTLSServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
31 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&called3, 1)
32 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("srv3 req %s %s", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method., r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path.)
33 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
34
35 switch r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. {
36 case "/upgrade":
37 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "auth", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Authorization"))
38 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("A"))
39 w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Location", srv3Https+"/upgraded")
40 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(301)
41 case "/upgraded":
42 // Since srv3 listens on both a TLS-enabled socket and a
43 // TLS-disabled one, they are two different hosts.
44 // Ensure that, even though this is a "secure" upgrade,
45 // the authorization header is stripped.
46 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Authorization"))
47 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("A"))
48
49 case "/downgrade":
50 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "auth", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Authorization"))
51 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("A"))
52 w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Location", srv3Http+"/404")
53 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(301)
54
55 default:
56 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404)
57 }
58 }))
59
60 srv2 := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
61 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&called2, 1)
62 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("srv2 req %s %s", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method., r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path.)
63 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
64
65 switch r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. {
66 case "/ok":
67 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Authorization"))
68 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("A"))
69 body := &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{}
70 err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewDecoder().(r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.).Decodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Decoder#Decode().(body)
71 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
72 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "External", body.Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.)
73
74 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
75 default:
76 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404)
77 }
78 }))
79
80 srv1 := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
81 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&called1, 1)
82 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("srv1 req %s %s", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method., r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path.)
83 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
84
85 switch r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. {
86 case "/local":
87 w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Location", "/ok")
88 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(307)
89 case "/external":
90 w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Location", srv2.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL.+"/ok")
91 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(307)
92 case "/ok":
93 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "auth", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Authorization"))
94 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("A"))
95 body := &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{}
96 err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewDecoder().(r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.).Decodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Decoder#Decode().(body)
97 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
98 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "Local", body.Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.)
99
100 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
101 default:
102 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404)
103 }
104 }))
105 defer srv1.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
106 defer srv2.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
107 defer srv3.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
108
109 srv3InsecureListener, err := netscip-go gomod github.com/golang/go/src go1.25.0 net/.Listenscip-go gomod github.com/golang/go/src go1.25.0 net/Listen().("tcp", "127.0.0.1:0")
110 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
111
112 go httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Servescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Serve().(srv3InsecureListener, srv3.Configscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Config..Handlerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Server#Handler.)
113 defer srv3InsecureListener.Closescip-go gomod github.com/golang/go/src go1.25.0 net/Listener#Close().()
114
115 srv3Https = srv3.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL.
116 srv3Http = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http://%s", srv3InsecureListener.Addrscip-go gomod github.com/golang/go/src go1.25.0 net/Listener#Addr().().Stringscip-go gomod github.com/golang/go/src go1.25.0 net/Addr#String().())
117
118 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
119 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.%s.sslverify", srv3Https): "false",
120 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.%s/.sslverify", srv3Https): "false",
121 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.%s.sslverify", srv3Http): "false",
122 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.%s/.sslverify", srv3Http): "false",
123 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.sslverify"): "false",
124 }))
125
126 // local redirect
127 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("POST", srv1.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL.+"/local", nil)
128 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
129 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Authorization", "auth")
130 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("A", "1")
131
132 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.: "Local"}))
133
134 res, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
135 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
136 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
137 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 2, called1)
138 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 0, called2)
139
140 // external redirect
141 req, err = httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("POST", srv1.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL.+"/external", nil)
142 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
143 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Authorization", "auth")
144 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("A", "1")
145
146 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.: "External"}))
147
148 res, err = c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
149 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
150 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
151 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 3, called1)
152 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 1, called2)
153
154 // http -> https (secure upgrade)
155
156 req, err = httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("POST", srv3Http+"/upgrade", nil)
157 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
158 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Authorization", "auth")
159 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("A", "1")
160
161 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.: "http->https"}))
162
163 res, err = c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
164 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
165 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
166 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 2, atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.LoadUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/LoadUint32().(&called3))
167
168 // https -> http (insecure downgrade)
169
170 req, err = httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("POST", srv3Https+"/downgrade", nil)
171 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
172 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Authorization", "auth")
173 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("A", "1")
174
175 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, &redirectTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#{Testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/redirectTest#Test.: "https->http"}))
176
177 _, err = c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
178 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualError().(t, err, "refusing insecure redirect: HTTPS to HTTP")
179 }
180
181 func TestNewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewClient().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
182 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
183 "lfs.dialtimeout": "151",
184 "lfs.keepalive": "152",
185 "lfs.tlstimeout": "153",
186 "lfs.concurrenttransfers": "154",
187 }))
188
189 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 151, c.DialTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#DialTimeout.)
190 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 152, c.KeepaliveTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#KeepaliveTimeout.)
191 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 153, c.TLSTimeoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#TLSTimeout.)
192 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 154, c.ConcurrentTransfersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ConcurrentTransfers.)
193 }
194
195 func TestNewClientWithGitSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewClientWithGitSSLVerify().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
196 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(nil)
197 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
198
199 for _, value := range []string{"true", "1", "t"} {
200 c = NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
201 "http.sslverify": value,
202 }))
203 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("http.sslverify: %q", value)
204 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
205 }
206
207 for _, value := range []string{"false", "0", "f"} {
208 c = NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
209 "http.sslverify": value,
210 }))
211 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("http.sslverify: %q", value)
212 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
213 }
214 }
215
216 func TestNewClientWithOSSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewClientWithOSSSLVerify().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
217 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(nil)
218 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
219
220 for _, value := range []string{"false", "0", "f"} {
221 c = NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{
222 "GIT_SSL_NO_VERIFY": value,
223 }, nil))
224 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("GIT_SSL_NO_VERIFY: %q", value)
225 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
226 }
227
228 for _, value := range []string{"true", "1", "t"} {
229 c = NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, map[string]string{
230 "GIT_SSL_NO_VERIFY": value,
231 }, nil))
232 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("GIT_SSL_NO_VERIFY: %q", value)
233 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, c.SkipSSLVerifyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SkipSSLVerify.)
234 }
235 }
236
237 func TestNewRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewRequest().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
238 tests := [][]string{
239 {"https://example.com", "a", "https://example.com/a"},
240 {"https://example.com/", "a", "https://example.com/a"},
241 {"https://example.com/a", "b", "https://example.com/a/b"},
242 {"https://example.com/a/", "b", "https://example.com/a/b"},
243 }
244
245 for _, test := range tests {
246 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, nil))
247
248 req, err := c.NewRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#NewRequest().("POST", Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.: test[0]}, test[1], nil)
249 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
250 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", req.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
251 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test[2], req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().(), fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("endpoint: %s, suffix: %s, expected: %s", test[0], test[1], test[2]))
252 }
253 }
254
255 func TestNewRequestWithBodyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewRequestWithBody().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
256 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, nil))
257
258 body := struct {
259 Test string
260 }{Test: "test"}
261 req, err := c.NewRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#NewRequest().("POST", Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.: "https://example.com"}, "body", body)
262 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
263
264 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, req.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.)
265 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "15", req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Length"))
266 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 15, req.ContentLengthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#ContentLength.)
267 }
268
269 func TestNewRequestUsesGuessedEndpointWhenAuthenticateUnavailablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestNewRequestUsesGuessedEndpointWhenAuthenticateUnavailable().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
270 resolver := &countingResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#{
271 errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#err.: &sshAuthenticateUnavailableErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthenticateUnavailableError#{
272 errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthenticateUnavailableError#err.: errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("bash: git-lfs-authenticate: command not found"),
273 },
274 }
275 c := newTestClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newTestClient().(t, resolver)
276
277 req, err := c.NewRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#NewRequest().("GET", testSSHEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testSSHEndpoint().(), "objects/batch", nil)
278 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
279 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t,
280 "https://git-server.com/foo/bar.git/info/lfs/objects/batch",
281 req.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Stringscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#String().())
282 }
283
284 func TestMarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestMarshalToRequest().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
285 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("POST", "https://foo/bar", nil)
286 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
287
288 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, req.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.)
289 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Length"))
290 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 0, req.ContentLengthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#ContentLength.)
291
292 body := struct {
293 Test string
294 }{Test: "test"}
295 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, MarshalToRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MarshalToRequest().(req, body))
296
297 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, req.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.)
298 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "15", req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Length"))
299 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 15, req.ContentLengthscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#ContentLength.)
300 }
301
302 func TestHttp2scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestHttp2().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
303 var calledSrvTLS uint32
304 var calledSrv uint32
305
306 srvTLS := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewUnstartedServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewUnstartedServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
307 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&calledSrvTLS, 1)
308 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "GET", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
309 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "HTTP/2.0", r.Protoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Proto.)
310 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
311 }))
312 srvTLS.TLSscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#TLS. = &tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#{NextProtosscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#NextProtos.: []string{"h2", "http/1.1"}}
313 srvTLS.StartTLSscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#StartTLS().()
314
315 srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
316 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&calledSrv, 1)
317 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "GET", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
318 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "HTTP/1.1", r.Protoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Proto.)
319 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
320 }))
321
322 defer srvTLS.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
323 defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
324
325 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
326 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("http.sslverify"): "false",
327 }))
328
329 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("GET", srvTLS.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL., nil)
330 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
331
332 res, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
333 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
334 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
335 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 1, calledSrvTLS)
336
337 req, err = httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("GET", srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL., nil)
338 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
339
340 res, err = c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
341 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
342 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
343 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 1, calledSrv)
344 }
345
346 func TestHttpVersionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestHttpVersion().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
347 testcases := []struct {
348 Proto string
349 Setting string
350 TLSOk bool
351 PlaintextOk bool
352 Error string
353 }{
354 {"HTTP/2.0", "HTTP/2", true, false, "HTTP/2 cannot be used except with TLS"},
355 {"HTTP/1.1", "HTTP/1.1", true, true, ""},
356 {"HTTP/2.0", "lalala", false, false, `Unknown HTTP version "lalala"`},
357 }
358
359 for _, test := range testcases {
360 var calledSrvTLS uint32
361 var calledSrv uint32
362
363 srvTLS := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewUnstartedServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewUnstartedServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
364 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&calledSrvTLS, 1)
365 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "GET", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
366 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, test.Proto, r.Protoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Proto.)
367 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
368 }))
369 srvTLS.TLSscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#TLS. = &tlsscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#{NextProtosscip-go gomod github.com/golang/go/src go1.25.0 `crypto/tls`/Config#NextProtos.: []string{"h2", "http/1.1"}}
370 srvTLS.StartTLSscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#StartTLS().()
371
372 srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) {
373 atomicscip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/.AddUint32scip-go gomod github.com/golang/go/src go1.25.0 `sync/atomic`/AddUint32().(&calledSrv, 1)
374 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "GET", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.)
375 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "HTTP/1.1", r.Protoscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Proto.)
376 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(200)
377 }))
378
379 defer srvTLS.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
380 defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
381
382 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{
383 "http.sslverify": "false",
384 "http.version": test.Setting,
385 }))
386
387 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("GET", srvTLS.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL., nil)
388 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
389
390 if test.TLSOk {
391 res, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
392 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
393 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
394 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 1, calledSrvTLS)
395 } else {
396 _, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
397 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, err)
398 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, err.Error(), test.Error)
399 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 0, calledSrv)
400 }
401
402 req, err = httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("GET", srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL., nil)
403 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
404
405 if test.PlaintextOk {
406 res, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
407 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
408 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, res.StatusCodescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Response#StatusCode.)
409 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 1, calledSrv)
410 } else {
411 _, err := c.Doscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#Do().(req)
412 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, err)
413 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, err.Error(), test.Error)
414 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, 0, calledSrv)
415 }
416 }
417 }
418
419 func TestExtraHeadersForDuplicationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestExtraHeadersForDuplication().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
420 targetURL := "https://example.com/repo.git"
421 extraHeaderKey := "Authorization"
422 extraHeaderValue := "Bearer mytoken"
423 extraHeader2Key := "Cache-Control"
424 extraHeader2Value1 := "no-cache"
425 extraHeader2Value2 := "no-store"
426
427 context := &testContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testContext#{
428 gitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testContext#gitConfig.: gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.NewConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/NewConfig().("", ""),
429 osEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testContext#osEnv.: make(testEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testEnv#),
430 gitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testContext#gitEnv.: configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.EnvironmentOfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/EnvironmentOf().(configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.MapFetcherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/MapFetcher().(map[string][]string{
431 "http.extraheader": []string{
432 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s: %s", extraHeaderKey, extraHeaderValue),
433 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s: %s", extraHeader2Key, extraHeader2Value1),
434 fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s: %s", extraHeader2Key, extraHeader2Value2),
435 },
436 })),
437 }
438
439 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(context)
440
441 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("Configured extraHeader: %v", c.GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#GitEnv().().GetAllscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#GetAll.("http.extraHeader"))
442
443 req, err := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.NewRequestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/NewRequest().("GET", targetURL, nil)
444 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err)
445
446 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. = c.ExtraHeadersForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ExtraHeadersFor().(req)
447 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("Headers after 1st call: %v", req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.)
448
449 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []string{extraHeaderValue}, req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.[extraHeaderKey], "Header should be present once after first call")
450 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []string{extraHeader2Value1, extraHeader2Value2}, req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.[extraHeader2Key], "Header with multiple values should be present twice after first call")
451
452 // Simulate retry with same request object
453 req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header. = c.ExtraHeadersForscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#ExtraHeadersFor().(req)
454
455 // Ensure headers are not duplicated on retry (regression test for #6202)
456 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []string{extraHeaderValue}, req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.[extraHeaderKey], "Header should still be present only once after second call")
457 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, []string{extraHeader2Value1, extraHeader2Value2}, req.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header.[extraHeader2Key], "Header with multiple values should still be present only twice after first call")
458 }