owncast/utils/restendpointhelper.go
mahmed2000 414a8aeed8
Rework utils/restendpointhelper to use the new chi router functionality (#3750)
* 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
2024-05-30 12:31:07 -07:00

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
}