diff --git a/README.md b/README.md index 03def49..232b5b5 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ In order to match the rules defined in the VirtualService we need to specify the For example: set the key and value to "stage" and "canary" to match the above rules defined in VirtualService. * We can first define a MetaExtractor and pass it to `RouterMiddleware` through `xdssuite.WithRouterMetaExtractor`. + * Notice: If RouterMetaExtractor is not configured, metainfo.GetAllValues will be used by default. ``` var ( routeKey = "stage" diff --git a/README_CN.md b/README_CN.md index 81e5d2d..7aa39a4 100644 --- a/README_CN.md +++ b/README_CN.md @@ -101,6 +101,7 @@ spec: 比如:将 key 和 value 设置为“stage”和“canary”,以匹配 VirtualService 中定义的上述规则。 * 我们可以先定义一个元信息提取方法,并通过 `xdssuite.WithRouterMetaExtractor` 传入到 `RouterMiddleware` 中。 + * 注意:若未配置 RouteMetaExtractor,默认会使用 metainfo.GetAllValues 来获取。 ``` var ( routeKey = "stage" diff --git a/xdssuite/option.go b/xdssuite/option.go index 14663af..ee40e08 100644 --- a/xdssuite/option.go +++ b/xdssuite/option.go @@ -26,7 +26,7 @@ type routerMetaExtractor func(context.Context) map[string]string // Options for xds suite type Options struct { - routerMetaExtractor routerMetaExtractor + routerMetaExtractor routerMetaExtractor // use metainfo.GetAllValues by default. } func (o *Options) Apply(opts []Option) {