14 lines
329 B
Go
14 lines
329 B
Go
package pitransport
|
||
|
||
import "net/http"
|
||
|
||
const runnerAuthHeader = "Authorization"
|
||
|
||
// ApplyRunnerAuth 为 Runner HTTP 请求附加 Bearer token(token 为空时不设置)。
|
||
func ApplyRunnerAuth(req *http.Request, token string) {
|
||
if req == nil || token == "" {
|
||
return
|
||
}
|
||
req.Header.Set(runnerAuthHeader, "Bearer "+token)
|
||
}
|