mirror of
https://github.com/harness/drone.git
synced 2025-05-06 04:19:58 +08:00

To simplify UI code we are going to expose both Harness API and Standalone API (restricted to harness embedded functionalities) when running in harness mode. Furthermore, this PR adds a middleware that allows us to reuse standalone Handlers for Harness API for operations that don't require any request/response manipulation.
23 lines
613 B
Go
23 lines
613 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 (
|
|
QueryParamGitRef = "git_ref"
|
|
QueryParamIncludeCommit = "include_commit"
|
|
)
|
|
|
|
func GetGitRefFromQueryOrDefault(r *http.Request, deflt string) string {
|
|
return QueryParamOrDefault(r, QueryParamGitRef, deflt)
|
|
}
|
|
|
|
func GetIncludeCommitFromQueryOrDefault(r *http.Request, deflt bool) (bool, error) {
|
|
return QueryParamAsBoolOrDefault(r, QueryParamIncludeCommit, deflt)
|
|
}
|