mirror of
https://github.com/owncast/owncast.git
synced 2025-11-01 19:32:20 +08:00
* Initial plan * Fix all golangci-lint warnings (21 issues resolved) Co-authored-by: gabek <414923+gabek@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gabek <414923+gabek@users.noreply.github.com>
18 lines
351 B
Go
18 lines
351 B
Go
package utils
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
// GetURLParam retrieves the specified URL param from a given request.
|
|
func GetURLParam(r *http.Request, key string) (value string, err error) {
|
|
value = chi.URLParam(r, key)
|
|
if value == "" {
|
|
err = errors.New("request does not contain requested URL param")
|
|
}
|
|
return
|
|
}
|