2023-09-20 16:54:47 +02:00

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)
}