mirror of
https://github.com/owncast/owncast.git
synced 2024-12-18 07:12:33 +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
|
|
}
|