@@ -127,29 +127,19 @@ func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifi
127
127
}, nil
128
128
}
129
129
130
- // PingResponseError is used when the response from a ping
131
- // was received but invalid.
132
- type PingResponseError struct {
133
- Err error
134
- }
135
-
136
- func (err PingResponseError ) Error () string {
137
- return err .Err .Error ()
138
- }
139
-
140
130
// PingV2Registry attempts to ping a v2 registry and on success return a
141
131
// challenge manager for the supported authentication types.
142
132
// If a response is received but cannot be interpreted, a PingResponseError will be returned.
143
133
func PingV2Registry (endpoint * url.URL , authTransport http.RoundTripper ) (challenge.Manager , error ) {
144
- pingClient := & http.Client {
145
- Transport : authTransport ,
146
- Timeout : 15 * time .Second ,
147
- }
148
134
endpointStr := strings .TrimRight (endpoint .String (), "/" ) + "/v2/"
149
135
req , err := http .NewRequest (http .MethodGet , endpointStr , http .NoBody )
150
136
if err != nil {
151
137
return nil , err
152
138
}
139
+ pingClient := & http.Client {
140
+ Transport : authTransport ,
141
+ Timeout : 15 * time .Second ,
142
+ }
153
143
resp , err := pingClient .Do (req )
154
144
if err != nil {
155
145
return nil , err
@@ -158,9 +148,7 @@ func PingV2Registry(endpoint *url.URL, authTransport http.RoundTripper) (challen
158
148
159
149
challengeManager := challenge .NewSimpleManager ()
160
150
if err := challengeManager .AddResponse (resp ); err != nil {
161
- return nil , PingResponseError {
162
- Err : err ,
163
- }
151
+ return nil , err
164
152
}
165
153
166
154
return challengeManager , nil
0 commit comments