@@ -10,7 +10,6 @@ import (
1010 "time"
1111 "unicode"
1212
13- "github.com/admpub/xencoding/filter"
1413 json "github.com/admpub/xencoding/json/standard"
1514 xml "github.com/admpub/xencoding/xml/standard"
1615 "github.com/webx-top/echo/engine"
@@ -100,11 +99,11 @@ func (c *XContext) JSON(i interface{}, codes ...int) (err error) {
10099 }
101100 }
102101 var b []byte
103- if ft , ok := c .route .Get (metaKeyEncodingFilter ).(EncodingFilter ); ok {
102+ if ft , ok := c .route .Get (metaKeyEncodingConfig ).(EncodingConfig ); ok {
104103 b , err = json .MarshalWithOption (
105104 i ,
106- json .OptionFilter (filter . Exclude ( ft .OmitFields ... ) ),
107- json .OptionSelector (filter . Include ( ft .OnlyFields ... ) ),
105+ json .OptionFilter (ft .filter ),
106+ json .OptionSelector (ft .selector ),
108107 )
109108 } else {
110109 b , err = json .Marshal (i )
@@ -132,11 +131,11 @@ func (c *XContext) JSONP(callback string, i interface{}, codes ...int) (err erro
132131 }
133132 }
134133 var b []byte
135- if ft , ok := c .route .Get (metaKeyEncodingFilter ).(EncodingFilter ); ok {
134+ if ft , ok := c .route .Get (metaKeyEncodingConfig ).(EncodingConfig ); ok {
136135 b , err = json .MarshalWithOption (
137136 i ,
138- json .OptionFilter (filter . Exclude ( ft .OmitFields ... ) ),
139- json .OptionSelector (filter . Include ( ft .OnlyFields ... ) ),
137+ json .OptionFilter (ft .filter ),
138+ json .OptionSelector (ft .selector ),
140139 )
141140 } else {
142141 b , err = json .Marshal (i )
@@ -159,11 +158,11 @@ func (c *XContext) XML(i interface{}, codes ...int) (err error) {
159158 }
160159 }
161160 var b []byte
162- if ft , ok := c .route .Get (metaKeyEncodingFilter ).(EncodingFilter ); ok {
161+ if ft , ok := c .route .Get (metaKeyEncodingConfig ).(EncodingConfig ); ok {
163162 b , err = xml .MarshalWithOption (
164163 i ,
165- xml .OptionFilter (filter . Exclude ( ft .OmitFields ... ) ),
166- xml .OptionSelector (filter . Include ( ft .OnlyFields ... ) ),
164+ xml .OptionFilter (ft .filter ),
165+ xml .OptionSelector (ft .selector ),
167166 )
168167 } else {
169168 b , err = xml .Marshal (i )
0 commit comments