MCPcopy
hub / github.com/lxc/incus / DoHTTP

Method DoHTTP

client/incus.go:153–175  ·  view source on GitHub ↗

DoHTTP performs a Request, using OIDC authentication if set.

(req *http.Request)

Source from the content-addressed store, hash-verified

151
152// DoHTTP performs a Request, using OIDC authentication if set.
153func (r *ProtocolIncus) DoHTTP(req *http.Request) (*http.Response, error) {
154 r.addClientHeaders(req)
155
156 if r.oidcClient != nil {
157 return r.oidcClient.do(req)
158 }
159
160 resp, err := r.http.Do(req)
161 if resp != nil && resp.StatusCode == http.StatusUseProxy && req.GetBody != nil {
162 // Reset the request body.
163 body, err := req.GetBody()
164 if err != nil {
165 return nil, err
166 }
167
168 req.Body = body
169
170 // Retry the request.
171 return r.http.Do(req)
172 }
173
174 return resp, err
175}
176
177// DoWebsocket performs a websocket connection, using OIDC authentication if set.
178func (r *ProtocolIncus) DoWebsocket(dialer websocket.Dialer, uri string, req *http.Request) (*websocket.Conn, *http.Response, error) {

Callers 15

GetNetworkACLLogfileMethod · 0.95
GetStorageVolumeFileMethod · 0.95
GetMetricsMethod · 0.95
rawQueryMethod · 0.95
CreateImageMethod · 0.95
GetInstanceFileMethod · 0.95
CreateInstanceFileMethod · 0.95

Calls 3

addClientHeadersMethod · 0.95
DoMethod · 0.80
doMethod · 0.45

Tested by

no test coverage detected