Skip to content

Commit

Permalink
fix queryparams convertStruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao Xu committed Dec 13, 2015
1 parent c458cd7 commit 2eba8b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/conversion/queryparams/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"reflect"
"strings"

"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)

Expand Down Expand Up @@ -144,6 +145,12 @@ func convertStruct(result url.Values, st reflect.Type, sv reflect.Value) {
addListOfParams(result, tag, omitempty, field)
}
case isStructKind(kind) && !(zeroValue(field) && omitempty):
if selector, ok := field.Interface().(unversioned.LabelSelector); ok {
addParam(result, tag, omitempty, reflect.ValueOf(selector.Selector.String()))
}
if selector, ok := field.Interface().(unversioned.FieldSelector); ok {
addParam(result, tag, omitempty, reflect.ValueOf(selector.Selector.String()))
}
convertStruct(result, ft, field)
}
}
Expand Down

0 comments on commit 2eba8b7

Please sign in to comment.