Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kubitre committed Feb 1, 2022
1 parent 2ee3bc6 commit 117060e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extractors/extract_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 != "" {
Expand Down

0 comments on commit 117060e

Please sign in to comment.