refactor rest code (#895)
This commit is contained in:
@@ -322,12 +322,13 @@ func (u *Unmarshaler) processNamedField(field reflect.StructField, value reflect
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
k := key
|
|
||||||
if u.opts.canonicalKey != nil {
|
|
||||||
k = u.opts.canonicalKey(key)
|
|
||||||
}
|
|
||||||
fullName = join(fullName, key)
|
fullName = join(fullName, key)
|
||||||
mapValue, hasValue := getValue(m, k)
|
canonicalKey := key
|
||||||
|
if u.opts.canonicalKey != nil {
|
||||||
|
canonicalKey = u.opts.canonicalKey(key)
|
||||||
|
}
|
||||||
|
mapValue, hasValue := getValue(m, canonicalKey)
|
||||||
if hasValue {
|
if hasValue {
|
||||||
return u.processNamedFieldWithValue(field, value, mapValue, key, opts, fullName)
|
return u.processNamedFieldWithValue(field, value, mapValue, key, opts, fullName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ const (
|
|||||||
var (
|
var (
|
||||||
formUnmarshaler = mapping.NewUnmarshaler(formKey, mapping.WithStringValues())
|
formUnmarshaler = mapping.NewUnmarshaler(formKey, mapping.WithStringValues())
|
||||||
pathUnmarshaler = mapping.NewUnmarshaler(pathKey, mapping.WithStringValues())
|
pathUnmarshaler = mapping.NewUnmarshaler(pathKey, mapping.WithStringValues())
|
||||||
headerUnmarshaler = mapping.NewUnmarshaler(headerKey, mapping.WithStringValues(), mapping.WithCanonicalKeyFunc(textproto.CanonicalMIMEHeaderKey))
|
headerUnmarshaler = mapping.NewUnmarshaler(headerKey, mapping.WithStringValues(),
|
||||||
|
mapping.WithCanonicalKeyFunc(textproto.CanonicalMIMEHeaderKey))
|
||||||
)
|
)
|
||||||
|
|
||||||
// Parse parses the request.
|
// Parse parses the request.
|
||||||
|
|||||||
Reference in New Issue
Block a user