This is an automated email from the ASF dual-hosted git repository. asifdxtreme pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git
commit 272ca4a9d8db8a2eec924a25be3eae693dc4405a Author: wangqijun <wangqj2...@sohu.com> AuthorDate: Sat May 25 16:07:08 2019 +0800 use const --- server/resource/v1/common.go | 1 + server/resource/v1/kv_resource.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/resource/v1/common.go b/server/resource/v1/common.go index e246602..c9fb5bb 100644 --- a/server/resource/v1/common.go +++ b/server/resource/v1/common.go @@ -27,6 +27,7 @@ import ( ) const ( + TenantHeaderParam = "X-Domain-Name" FindExact = "exact" FindMany = "greedy" MsgDomainMustNotBeEmpty = "domain must not be empty" diff --git a/server/resource/v1/kv_resource.go b/server/resource/v1/kv_resource.go index 4839279..0ecd74c 100644 --- a/server/resource/v1/kv_resource.go +++ b/server/resource/v1/kv_resource.go @@ -200,7 +200,7 @@ func (r *KVResource) URLPatterns() []restful.Route { ParamType: goRestful.PathParameterKind, }, { DataType: "string", - Name: "X-Domain-Name", + Name: TenantHeaderParam, ParamType: goRestful.HeaderParameterKind, Desc: "set kv to other tenant", }, { @@ -216,8 +216,8 @@ func (r *KVResource) URLPatterns() []restful.Route { Message: "true", }, }, - Consumes: []string{"application/json"}, - Produces: []string{"application/json"}, + Consumes: []string{goRestful.MIME_JSON}, + Produces: []string{goRestful.MIME_JSON}, Read: &KVBody{}, }, { Method: http.MethodGet, @@ -231,7 +231,7 @@ func (r *KVResource) URLPatterns() []restful.Route { ParamType: goRestful.PathParameterKind, }, { DataType: "string", - Name: "X-Domain-Name", + Name: TenantHeaderParam, ParamType: goRestful.HeaderParameterKind, }, { DataType: "string", @@ -247,8 +247,8 @@ func (r *KVResource) URLPatterns() []restful.Route { Model: []*KVBody{}, }, }, - Consumes: []string{"application/json"}, - Produces: []string{"application/json"}, + Consumes: []string{goRestful.MIME_JSON}, + Produces: []string{goRestful.MIME_JSON}, Read: &KVBody{}, }, { Method: http.MethodGet, @@ -258,7 +258,7 @@ func (r *KVResource) URLPatterns() []restful.Route { Parameters: []*restful.Parameters{ { DataType: "string", - Name: "X-Domain-Name", + Name: TenantHeaderParam, ParamType: goRestful.HeaderParameterKind, }, { DataType: "string", @@ -274,8 +274,8 @@ func (r *KVResource) URLPatterns() []restful.Route { Model: []*KVBody{}, }, }, - Consumes: []string{"application/json"}, - Produces: []string{"application/json"}, + Consumes: []string{goRestful.MIME_JSON}, + Produces: []string{goRestful.MIME_JSON}, }, { Method: http.MethodDelete, Path: "/v1/kv/{ids}", @@ -284,7 +284,7 @@ func (r *KVResource) URLPatterns() []restful.Route { Parameters: []*restful.Parameters{ { DataType: "string", - Name: "X-Domain-Name", + Name: TenantHeaderParam, ParamType: goRestful.HeaderParameterKind, }, { DataType: "string",