matrixcloud / internal /hf /auth.go
github-actions[bot]
Deploy from 4dfd54f2
857a91b
Raw
History Blame Contribute Delete
235 Bytes
package hf
import "net/http"
// applyAuth attaches a bearer token to the request when a token is configured.
func applyAuth(req *http.Request, token string) {
if token != "" {
req.Header.Set("Authorization", "Bearer "+token)
}
}