MCPcopy
hub / github.com/git-lfs/git-lfs / setRequestAuthWithCreds

Function setRequestAuthWithCreds

lfsapi/auth.go:319–331  ·  view source on GitHub ↗
(req *http.Request, c creds.Creds)

Source from the content-addressed store, hash-verified

317}
318
319func setRequestAuthWithCreds(req *http.Request, c creds.Creds) {
320 authtype := creds.FirstEntryForKey(c, "authtype")
321 credential := creds.FirstEntryForKey(c, "credential")
322 if len(authtype) == 0 && len(credential) == 0 {
323 user := creds.FirstEntryForKey(c, "username")
324 pass := creds.FirstEntryForKey(c, "password")
325 setRequestAuth(req, user, pass)
326 return
327 }
328
329 auth := fmt.Sprintf("%s %s", authtype, credential)
330 req.Header.Set("Authorization", auth)
331}
332
333func getReqOperation(req *http.Request) string {
334 operation := "download"

Callers 1

getCredsMethod · 0.85

Calls 3

FirstEntryForKeyFunction · 0.92
setRequestAuthFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected