chore: change interface{} to any (#2818)
* chore: change interface{} to any
* chore: update goctl version to 1.5.0
* chore: update goctl deps
This commit is contained in:
@@ -26,7 +26,7 @@ var (
|
||||
)
|
||||
|
||||
// Parse parses the request.
|
||||
func Parse(r *http.Request, v interface{}) error {
|
||||
func Parse(r *http.Request, v any) error {
|
||||
if err := ParsePath(r, v); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -43,12 +43,12 @@ func Parse(r *http.Request, v interface{}) error {
|
||||
}
|
||||
|
||||
// ParseHeaders parses the headers request.
|
||||
func ParseHeaders(r *http.Request, v interface{}) error {
|
||||
func ParseHeaders(r *http.Request, v any) error {
|
||||
return encoding.ParseHeaders(r.Header, v)
|
||||
}
|
||||
|
||||
// ParseForm parses the form request.
|
||||
func ParseForm(r *http.Request, v interface{}) error {
|
||||
func ParseForm(r *http.Request, v any) error {
|
||||
params, err := GetFormValues(r)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -80,7 +80,7 @@ func ParseHeader(headerValue string) map[string]string {
|
||||
}
|
||||
|
||||
// ParseJsonBody parses the post request which contains json in body.
|
||||
func ParseJsonBody(r *http.Request, v interface{}) error {
|
||||
func ParseJsonBody(r *http.Request, v any) error {
|
||||
if withJsonBody(r) {
|
||||
reader := io.LimitReader(r.Body, maxBodyLen)
|
||||
return mapping.UnmarshalJsonReader(reader, v)
|
||||
@@ -91,9 +91,9 @@ func ParseJsonBody(r *http.Request, v interface{}) error {
|
||||
|
||||
// ParsePath parses the symbols reside in url path.
|
||||
// Like http://localhost/bag/:name
|
||||
func ParsePath(r *http.Request, v interface{}) error {
|
||||
func ParsePath(r *http.Request, v any) error {
|
||||
vars := pathvar.Vars(r)
|
||||
m := make(map[string]interface{}, len(vars))
|
||||
m := make(map[string]any, len(vars))
|
||||
for k, v := range vars {
|
||||
m[k] = v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user