mirror of
https://github.com/harness/drone.git
synced 2025-05-01 21:21:11 +00:00
27 lines
708 B
Go
27 lines
708 B
Go
// Copyright 2022 Harness Inc. All rights reserved.
|
|
// Use of this source code is governed by the Polyform Free Trial License
|
|
// that can be found in the LICENSE.md file for this repository.
|
|
|
|
package request
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
QueryParamAccessToken = "access_token"
|
|
QueryParamIncludeCookie = "include_cookie"
|
|
)
|
|
|
|
func GetAccessTokenFromQuery(r *http.Request) (string, bool) {
|
|
return QueryParam(r, QueryParamAccessToken)
|
|
}
|
|
|
|
func GetIncludeCookieFromQueryOrDefault(r *http.Request, dflt bool) (bool, error) {
|
|
return QueryParamAsBoolOrDefault(r, QueryParamIncludeCookie, dflt)
|
|
}
|
|
|
|
func GetTokenFromCookie(r *http.Request, cookieName string) (string, bool) {
|
|
return GetCookie(r, cookieName)
|
|
}
|