File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func tryParseInt(str string) (int, bool) {
4444 return 0 , false
4545}
4646
47- func ParseTypedQuery (values []string ) interface {} {
47+ func ParseTypedQueryValues (values []string ) interface {} {
4848 var result interface {}
4949
5050 raw := values [0 ]
@@ -80,3 +80,21 @@ func ParseTypedQuery(values []string) interface{} {
8080
8181 return result
8282}
83+
84+ func ParseTypedQuery (query string , matchPrefix string ) (map [string ]interface {}) {
85+ addedData := map [string ]interface {}{}
86+
87+ queryData := ParseRawQuery (query )
88+
89+ for key , value := range queryData {
90+ keyWithoutPrefix , match := strings .CutPrefix (key , matchPrefix )
91+
92+ if match {
93+ newValue := ParseTypedQueryValues (value )
94+
95+ addedData [keyWithoutPrefix ] = newValue
96+ }
97+ }
98+
99+ return addedData
100+ }
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ func GetFormData(body []byte) (map[string]interface{}, error) {
7676 }
7777
7878 for key , value := range queryData {
79- data [key ] = query .ParseTypedQuery (value )
79+ data [key ] = query .ParseTypedQueryValues (value )
8080 }
8181
8282 return data , nil
You can’t perform that action at this time.
0 commit comments