mirror of
https://github.com/owncast/owncast.git
synced 2024-11-30 14:21:36 +03:00
414a8aeed8
* Remove old implementation, add new function to work with the chi router * Use new URL Param function to get clientID instead * Remove usage of old restendpoint functions * Fix typo in url param name * Remove unused tests
17 lines
351 B
Go
17 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
|
|
}
|