From 117060e6e40c2422829a803565ebb7fe59d059d0 Mon Sep 17 00:00:00 2001 From: kubitre Date: Wed, 2 Feb 2022 02:12:23 +0700 Subject: [PATCH] fixed --- extractors/extract_request.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extractors/extract_request.go b/extractors/extract_request.go index eb2671a..b11d198 100644 --- a/extractors/extract_request.go +++ b/extractors/extract_request.go @@ -29,7 +29,7 @@ func RequestToType(request *http.Request, data interface{}, parseQuery, parsePar extractorFunc = extractFromPathVariables } - value := reflect.ValueOf(data) + value := reflect.Indirect(reflect.ValueOf(data)) if err := prepareInlineStructFields(request, value, extractorFunc); err != nil { return nil, err @@ -49,11 +49,11 @@ func extractFromPathVariables(paramName string, request *http.Request) string { func prepareInlineStructFields(request *http.Request, value reflect.Value, preparator extractor) error { for i := 0; i < value.NumField(); i++ { - val := value.Field(i).Addr() + val := reflect.Indirect(value.Field(i).Addr()) if val.Kind() == reflect.Struct { prepareInlineStructFields(request, val, preparator) } else { - parsedTag := val.Type().Field(i).Tag.Get(tagParsing) + parsedTag := value.Type().Field(i).Tag.Get(tagParsing) if parsedTag != "" { dataQuery := request.URL.Query().Get(parsedTag) if dataQuery != "" {