Repository: go-kratos/kratos
Pull request #3266 (2024-03-22 15:34:45)

deps: upgrade kratos version to v2.7.3
<!--
🎉 Thanks for sending a pull request to Kratos! Here are some tips for you:

1. If this is your first time contributing to Kratos, please read our contribution guide: https://go-kratos.dev/en/docs/community/contribution/
2. Ensure you have added or ran the appropriate tests and lint for your PR, please use `make lint` and `make test` before filing your PR, use `make clean` to tidy your go mod.
3. If the PR is unfinished, you may need to mark it as a WIP(Work In Progress) PR or Draft PR
4. Please use a semantic commits format title, such as `<type>[optional scope]: <description>`, see: https://go-kratos.dev/docs/community/contribution#type
5. at the same time, please note that similar work should be submitted in one PR as far as possible to reduce the workload of reviewers. Do not split a work into multiple PR unless it should.
-->

<!--
🎉 感谢您向 Kratos 发送 PR！以下是一些提示：
如果这是你第一次为 Kratos 贡献，请阅读我们的贡献指南：https://go-kratos.dev/en/docs/community/contribution/
2、确保您已经为您的 PR 添加或运行了适当的测试和lint，请在提交PR之前使用“make lint”和“make test”，使用“make clean”整理您的 go.mod。
3、如果 PR 未完成，您可能需要将其标记为 WIP（Work In Progress）PR 或 Draft PR
4、请使用语义提交格式标题，如“<类型>[可选范围]：<说明>`，请参阅：https://go-kratos.dev/docs/community/contribution#type
5. 同时请注意，同类的工作请尽量在一个PR中提交，以减轻 review 者的工作负担，不要把一项工作拆分成很多个PR，除非它应该这样做。
-->


#### Description (what this PR does / why we need it):
<!--
* The description should include the motivation for this PR or contrast this with previous behavior
-->


#### Which issue(s) this PR fixes (resolves / be part of):
<!--
* Automatically closes linked issue when PR is merged.
* If your PR is not fully resolved the issue, please use `part of #<issue number>` instead.

Usage: `fixes/resolves #<issue number>`, or `fixes/resolves (paste link of issue)`.
-->


#### Other special notes for the reviewers:
<!--
* Somethings that need extra attention for the reviewers
* Some additional notes, TODO list, etc.
-->



Patch:
diff --git a/cmd/kratos/version.go b/cmd/kratos/version.go
index 9312f2c1..80879d35 100644
--- a/cmd/kratos/version.go
+++ b/cmd/kratos/version.go
@@ -1,4 +1,4 @@
 package main
 
 // release is the current kratos tool version.
-const release = "v2.7.2"
+const release = "v2.7.3"
diff --git a/cmd/protoc-gen-go-errors/version.go b/cmd/protoc-gen-go-errors/version.go
index 004fab19..d45826c5 100644
--- a/cmd/protoc-gen-go-errors/version.go
+++ b/cmd/protoc-gen-go-errors/version.go
@@ -1,4 +1,4 @@
 package main
 
 // release is the current protoc-gen-go-errors version.
-const release = "v2.7.2"
+const release = "v2.7.3"
diff --git a/cmd/protoc-gen-go-http/version.go b/cmd/protoc-gen-go-http/version.go
index fba0718f..0d3515dc 100644
--- a/cmd/protoc-gen-go-http/version.go
+++ b/cmd/protoc-gen-go-http/version.go
@@ -1,4 +1,4 @@
 package main
 
 // release is the current protoc-gen-go-http version.
-const release = "v2.7.2"
+const release = "v2.7.3"
diff --git a/contrib/config/apollo/go.mod b/contrib/config/apollo/go.mod
index 3b63a663..b1ee6b8e 100644
--- a/contrib/config/apollo/go.mod
+++ b/contrib/config/apollo/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/apolloconfig/agollo/v4 v4.3.1
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 )
 
 require (
diff --git a/contrib/config/consul/go.mod b/contrib/config/consul/go.mod
index 92adfe1a..1bcc5cc9 100644
--- a/contrib/config/consul/go.mod
+++ b/contrib/config/consul/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/config/consul/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/hashicorp/consul/api v1.26.1
 )
 
diff --git a/contrib/config/etcd/go.mod b/contrib/config/etcd/go.mod
index ec2dee60..4c50f268 100644
--- a/contrib/config/etcd/go.mod
+++ b/contrib/config/etcd/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/config/etcd/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	go.etcd.io/etcd/client/v3 v3.5.11
 	google.golang.org/grpc v1.59.0
 )
diff --git a/contrib/config/kubernetes/go.mod b/contrib/config/kubernetes/go.mod
index 86ec0692..d4a5b3d9 100644
--- a/contrib/config/kubernetes/go.mod
+++ b/contrib/config/kubernetes/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/config/kubernetes/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	k8s.io/api v0.26.3
 	k8s.io/apimachinery v0.26.3
 	k8s.io/client-go v0.26.3
diff --git a/contrib/config/nacos/go.mod b/contrib/config/nacos/go.mod
index 37ef8392..6d2cc17a 100644
--- a/contrib/config/nacos/go.mod
+++ b/contrib/config/nacos/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/config/nacos/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/nacos-group/nacos-sdk-go v1.0.9
 )
 
diff --git a/contrib/config/polaris/go.mod b/contrib/config/polaris/go.mod
index 20d95beb..fdfc1fbb 100644
--- a/contrib/config/polaris/go.mod
+++ b/contrib/config/polaris/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/config/polaris/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/polarismesh/polaris-go v1.1.0
 )
 
diff --git a/contrib/encoding/msgpack/go.mod b/contrib/encoding/msgpack/go.mod
index 999c5bbc..d9159164 100644
--- a/contrib/encoding/msgpack/go.mod
+++ b/contrib/encoding/msgpack/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/encoding/msgpack/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/vmihailenco/msgpack/v5 v5.4.1
 )
 
diff --git a/contrib/log/aliyun/go.mod b/contrib/log/aliyun/go.mod
index 965919f4..f6ef5866 100644
--- a/contrib/log/aliyun/go.mod
+++ b/contrib/log/aliyun/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/aliyun/aliyun-log-go-sdk v0.1.67
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	google.golang.org/protobuf v1.31.0
 )
 
diff --git a/contrib/log/fluent/go.mod b/contrib/log/fluent/go.mod
index 7849d38e..54d358b4 100644
--- a/contrib/log/fluent/go.mod
+++ b/contrib/log/fluent/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/fluent/fluent-logger-golang v1.9.0
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 )
 
 require (
diff --git a/contrib/log/logrus/go.mod b/contrib/log/logrus/go.mod
index 26aff03f..5a55bf3e 100644
--- a/contrib/log/logrus/go.mod
+++ b/contrib/log/logrus/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/log/logrus/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/sirupsen/logrus v1.8.1
 )
 
diff --git a/contrib/log/tencent/go.mod b/contrib/log/tencent/go.mod
index e052b6ea..5aa17498 100644
--- a/contrib/log/tencent/go.mod
+++ b/contrib/log/tencent/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/log/tencent/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/tencentcloud/tencentcloud-cls-sdk-go v1.0.2
 	google.golang.org/protobuf v1.31.0
 )
diff --git a/contrib/log/zap/go.mod b/contrib/log/zap/go.mod
index 8bea3ebf..85f4e05b 100644
--- a/contrib/log/zap/go.mod
+++ b/contrib/log/zap/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/log/zap/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	go.uber.org/zap v1.26.0
 )
 
diff --git a/contrib/log/zerolog/go.mod b/contrib/log/zerolog/go.mod
index 1720fd7f..c1979f6d 100644
--- a/contrib/log/zerolog/go.mod
+++ b/contrib/log/zerolog/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/log/zerolog/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/rs/zerolog v1.30.0
 )
 
diff --git a/contrib/metrics/datadog/go.mod b/contrib/metrics/datadog/go.mod
index 61d03435..2770bbc4 100644
--- a/contrib/metrics/datadog/go.mod
+++ b/contrib/metrics/datadog/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/DataDog/datadog-go v4.8.3+incompatible
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 )
 
 require (
diff --git a/contrib/metrics/prometheus/go.mod b/contrib/metrics/prometheus/go.mod
index 353d3153..06feef16 100644
--- a/contrib/metrics/prometheus/go.mod
+++ b/contrib/metrics/prometheus/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/metrics/prometheus/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/prometheus/client_golang v1.18.0
 	github.com/prometheus/common v0.46.0
 )
diff --git a/contrib/opensergo/go.mod b/contrib/opensergo/go.mod
index 136920cc..73819950 100644
--- a/contrib/opensergo/go.mod
+++ b/contrib/opensergo/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/opensergo/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/opensergo/opensergo-go v0.0.0-20220331070310-e5b01fee4d1c
 	golang.org/x/net v0.20.0
 	google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d
diff --git a/contrib/polaris/go.mod b/contrib/polaris/go.mod
index 46225dca..3af138d0 100644
--- a/contrib/polaris/go.mod
+++ b/contrib/polaris/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/go-kratos/aegis v0.2.0
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/google/uuid v1.3.0
 	github.com/polarismesh/polaris-go v1.3.0
 	google.golang.org/protobuf v1.31.0
diff --git a/contrib/registry/consul/go.mod b/contrib/registry/consul/go.mod
index d5af94b7..55dd41f5 100644
--- a/contrib/registry/consul/go.mod
+++ b/contrib/registry/consul/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/consul/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/hashicorp/consul/api v1.26.1
 )
 
diff --git a/contrib/registry/discovery/go.mod b/contrib/registry/discovery/go.mod
index 383562ce..93821a25 100644
--- a/contrib/registry/discovery/go.mod
+++ b/contrib/registry/discovery/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/discovery/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/go-resty/resty/v2 v2.11.0
 	github.com/pkg/errors v0.9.1
 )
diff --git a/contrib/registry/etcd/go.mod b/contrib/registry/etcd/go.mod
index ecac7c4c..4d1c1dd0 100644
--- a/contrib/registry/etcd/go.mod
+++ b/contrib/registry/etcd/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/etcd/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	go.etcd.io/etcd/client/v3 v3.5.11
 	google.golang.org/grpc v1.59.0
 )
diff --git a/contrib/registry/eureka/go.mod b/contrib/registry/eureka/go.mod
index a0bb8aa6..17608b5a 100644
--- a/contrib/registry/eureka/go.mod
+++ b/contrib/registry/eureka/go.mod
@@ -2,6 +2,6 @@ module github.com/go-kratos/kratos/contrib/registry/eureka/v2
 
 go 1.19
 
-require github.com/go-kratos/kratos/v2 v2.7.2
+require github.com/go-kratos/kratos/v2 v2.7.3
 
 replace github.com/go-kratos/kratos/v2 => ../../../
diff --git a/contrib/registry/kubernetes/go.mod b/contrib/registry/kubernetes/go.mod
index 8c5b87f7..75b55b8c 100644
--- a/contrib/registry/kubernetes/go.mod
+++ b/contrib/registry/kubernetes/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/kubernetes/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/json-iterator/go v1.1.12
 	k8s.io/api v0.24.3
 	k8s.io/apimachinery v0.24.3
diff --git a/contrib/registry/nacos/go.mod b/contrib/registry/nacos/go.mod
index 19e95ce0..fc02edc5 100644
--- a/contrib/registry/nacos/go.mod
+++ b/contrib/registry/nacos/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/nacos/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/nacos-group/nacos-sdk-go v1.0.9
 )
 
diff --git a/contrib/registry/polaris/go.mod b/contrib/registry/polaris/go.mod
index 9831f2ab..f8582e0e 100644
--- a/contrib/registry/polaris/go.mod
+++ b/contrib/registry/polaris/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/polaris/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/polarismesh/polaris-go v1.3.0
 )
 
diff --git a/contrib/registry/zookeeper/go.mod b/contrib/registry/zookeeper/go.mod
index 8a642beb..58603987 100644
--- a/contrib/registry/zookeeper/go.mod
+++ b/contrib/registry/zookeeper/go.mod
@@ -3,7 +3,7 @@ module github.com/go-kratos/kratos/contrib/registry/zookeeper/v2
 go 1.19
 
 require (
-	github.com/go-kratos/kratos/v2 v2.7.2
+	github.com/go-kratos/kratos/v2 v2.7.3
 	github.com/go-zookeeper/zk v1.0.3
 	golang.org/x/sync v0.6.0
 )
diff --git a/encoding/form/proto_decode.go b/encoding/form/proto_decode.go
index b6931cef..94ce333b 100644
--- a/encoding/form/proto_decode.go
+++ b/encoding/form/proto_decode.go
@@ -244,7 +244,7 @@ func parseMessage(md protoreflect.MessageDescriptor, value string) (protoreflect
 		if value == nullStr {
 			break
 		}
-		t, err := time.Parse(time.RFC3339Nano, value)
+		t, err := time.ParseInLocation(time.RFC3339Nano, value, time.Local)
 		if err != nil {
 			return protoreflect.Value{}, err
 		}
diff --git a/encoding/form/proto_encode.go b/encoding/form/proto_encode.go
index 584b1da5..67b92f92 100644
--- a/encoding/form/proto_encode.go
+++ b/encoding/form/proto_encode.go
@@ -137,14 +137,12 @@ func EncodeField(fieldDescriptor protoreflect.FieldDescriptor, value protoreflec
 		}
 		desc := fieldDescriptor.Enum().Values().ByNumber(value.Enum())
 		return string(desc.Name()), nil
-	case protoreflect.StringKind:
-		return value.String(), nil
 	case protoreflect.BytesKind:
 		return base64.URLEncoding.EncodeToString(value.Bytes()), nil
 	case protoreflect.MessageKind, protoreflect.GroupKind:
 		return encodeMessage(fieldDescriptor.Message(), value)
 	default:
-		return fmt.Sprint(value.Interface()), nil
+		return value.String(), nil
 	}
 }
 
diff --git a/transport/http/context.go b/transport/http/context.go
index ab9a1d39..43ea78ce 100644
--- a/transport/http/context.go
+++ b/transport/http/context.go
@@ -57,6 +57,7 @@ func (w *responseWriter) Write(data []byte) (int, error) {
 	w.w.WriteHeader(w.code)
 	return w.w.Write(data)
 }
+func (w *responseWriter) Unwrap() http.ResponseWriter { return w.w }
 
 type wrapper struct {
 	router *Router
diff --git a/version.go b/version.go
index 4de5e07e..891c2c07 100644
--- a/version.go
+++ b/version.go
@@ -1,4 +1,4 @@
 package kratos
 
 // Release is the current kratos version.
-const Release = "v2.7.2"
+const Release = "v2.7.3"


Test patch:
diff --git a/encoding/form/form_test.go b/encoding/form/form_test.go
index 484e42fa..8ab628b5 100644
--- a/encoding/form/form_test.go
+++ b/encoding/form/form_test.go
@@ -87,10 +87,6 @@ func TestFormCodecUnmarshal(t *testing.T) {
 }
 
 func TestProtoEncodeDecode(t *testing.T) {
-	loc := time.Local
-	time.Local = time.UTC
-	t.Cleanup(func() { time.Local = loc })
-
 	in := &complex.Complex{
 		Id:      2233,
 		NoOne:   "2233",
@@ -106,7 +102,7 @@ func TestProtoEncodeDecode(t *testing.T) {
 		Byte:    []byte("123"),
 		Map:     map[string]string{"kratos": "https://go-kratos.dev/", "kratos_start": "https://go-kratos.dev/en/docs/getting-started/start/"},
 
-		Timestamp: &timestamppb.Timestamp{Seconds: 20, Nanos: 2},
+		Timestamp: timestamppb.New(time.Date(1970, 1, 1, 0, 0, 20, 2, time.Local)),
 		Duration:  &durationpb.Duration{Seconds: 120, Nanos: 22},
 		Field:     &fieldmaskpb.FieldMask{Paths: []string{"1", "2"}},
 		Double:    &wrapperspb.DoubleValue{Value: 12.33},
diff --git a/encoding/form/proto_encode_test.go b/encoding/form/proto_encode_test.go
index 1b4e11e3..aa15b1fe 100644
--- a/encoding/form/proto_encode_test.go
+++ b/encoding/form/proto_encode_test.go
@@ -13,26 +13,23 @@ import (
 )
 
 func TestEncodeValues(t *testing.T) {
-	loc := time.Local
-	time.Local = time.UTC
-	t.Cleanup(func() { time.Local = loc })
-
 	in := &complex.Complex{
-		Id:      2233,
-		NoOne:   "2233",
-		Simple:  &complex.Simple{Component: "5566"},
-		Simples: []string{"3344", "5566"},
-		B:       true,
-		Sex:     complex.Sex_woman,
-		Age:     18,
-		A:       19,
-		Count:   3,
-		Price:   11.23,
-		D:       22.22,
-		Byte:    []byte("123"),
-		Map:     map[string]string{"kratos": "https://go-kratos.dev/", "kratos_start": "https://go-kratos.dev/en/docs/getting-started/start/"},
+		Id:          2233,
+		NoOne:       "2233",
+		Simple:      &complex.Simple{Component: "5566"},
+		Simples:     []string{"3344", "5566"},
+		B:           true,
+		Sex:         complex.Sex_woman,
+		Age:         18,
+		A:           19,
+		Count:       3,
+		Price:       11.23,
+		D:           22.22,
+		Byte:        []byte("123"),
+		Map:         map[string]string{"kratos": "https://go-kratos.dev/", "kratos_start": "https://go-kratos.dev/en/docs/getting-started/start/"},
+		MapInt64Key: map[int64]string{1: "kratos", 2: "go-zero"},
 
-		Timestamp: &timestamppb.Timestamp{Seconds: 20, Nanos: 2},
+		Timestamp: timestamppb.New(time.Date(1970, 1, 1, 0, 0, 20, 2, time.Local)),
 		Duration:  &durationpb.Duration{Seconds: 120, Nanos: 22},
 		Field:     &fieldmaskpb.FieldMask{Paths: []string{"1", "2"}},
 		Double:    &wrapperspb.DoubleValue{Value: 12.33},
@@ -49,9 +46,9 @@ func TestEncodeValues(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	want := "a=19&age=18&b=true&bool=false&byte=MTIz&bytes=MTIz&count=3&d=22.22&double=12.33&duration=2m0.000000022s&field=1%2C2&float=12.34&id=2233&int32=32&int64=64&map%5Bkratos%5D=https%3A%2F%2Fgo-kratos.dev%2F&map%5Bkratos_start%5D=https%3A%2F%2Fgo-kratos.dev%2Fen%2Fdocs%2Fgetting-started%2Fstart%2F&numberOne=2233&price=11.23&sex=woman&simples=3344&simples=5566&string=go-kratos&timestamp=1970-01-01T00%3A00%3A20.000000002Z&uint32=32&uint64=64&very_simple.component=5566" // nolint:lll
+	want := "a=19&age=18&b=true&bool=false&byte=MTIz&bytes=MTIz&count=3&d=22.22&double=12.33&duration=2m0.000000022s&field=1%2C2&float=12.34&id=2233&int32=32&int64=64&map%5Bkratos%5D=https%3A%2F%2Fgo-kratos.dev%2F&map%5Bkratos_start%5D=https%3A%2F%2Fgo-kratos.dev%2Fen%2Fdocs%2Fgetting-started%2Fstart%2F&map_int64_key%5B1%5D=kratos&map_int64_key%5B2%5D=go-zero&numberOne=2233&price=11.23&sex=woman&simples=3344&simples=5566&string=go-kratos&timestamp=1970-01-01T00%3A00%3A20.000000002Z&uint32=32&uint64=64&very_simple.component=5566" // nolint:lll
 	if got := query.Encode(); want != got {
-		t.Errorf("want: %s, got: %s", want, got)
+		t.Errorf("\nwant: %s, \ngot: %s", want, got)
 	}
 }
 
diff --git a/internal/testdata/complex/complex.pb.go b/internal/testdata/complex/complex.pb.go
index e11b9d4b..216c3617 100644
--- a/internal/testdata/complex/complex.pb.go
+++ b/internal/testdata/complex/complex.pb.go
@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.27.1
-// 	protoc        v3.17.3
+// 	protoc        v3.19.1
 // source: complex.proto
 
 package complex
@@ -77,31 +77,32 @@ type Complex struct {
 	unknownFields protoimpl.UnknownFields
 
 	// Id represents the message identifier.
-	Id        int64                   `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
-	NoOne     string                  `protobuf:"bytes,2,opt,name=no_one,json=numberOne,proto3" json:"no_one,omitempty"`
-	Simple    *Simple                 `protobuf:"bytes,3,opt,name=simple,json=very_simple,proto3" json:"simple,omitempty"`
-	Simples   []string                `protobuf:"bytes,4,rep,name=simples,proto3" json:"simples,omitempty"`
-	B         bool                    `protobuf:"varint,5,opt,name=b,proto3" json:"b,omitempty"`
-	Sex       Sex                     `protobuf:"varint,6,opt,name=sex,proto3,enum=testproto.Sex" json:"sex,omitempty"`
-	Age       int32                   `protobuf:"varint,7,opt,name=age,proto3" json:"age,omitempty"`
-	A         uint32                  `protobuf:"varint,8,opt,name=a,proto3" json:"a,omitempty"`
-	Count     uint64                  `protobuf:"varint,9,opt,name=count,proto3" json:"count,omitempty"`
-	Price     float32                 `protobuf:"fixed32,10,opt,name=price,proto3" json:"price,omitempty"`
-	D         float64                 `protobuf:"fixed64,11,opt,name=d,proto3" json:"d,omitempty"`
-	Byte      []byte                  `protobuf:"bytes,12,opt,name=byte,proto3" json:"byte,omitempty"`
-	Timestamp *timestamppb.Timestamp  `protobuf:"bytes,13,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
-	Duration  *durationpb.Duration    `protobuf:"bytes,14,opt,name=duration,proto3" json:"duration,omitempty"`
-	Field     *fieldmaskpb.FieldMask  `protobuf:"bytes,15,opt,name=field,proto3" json:"field,omitempty"`
-	Double    *wrapperspb.DoubleValue `protobuf:"bytes,16,opt,name=double,proto3" json:"double,omitempty"`
-	Float     *wrapperspb.FloatValue  `protobuf:"bytes,17,opt,name=float,proto3" json:"float,omitempty"`
-	Int64     *wrapperspb.Int64Value  `protobuf:"bytes,18,opt,name=int64,proto3" json:"int64,omitempty"`
-	Int32     *wrapperspb.Int32Value  `protobuf:"bytes,19,opt,name=int32,proto3" json:"int32,omitempty"`
-	Uint64    *wrapperspb.UInt64Value `protobuf:"bytes,20,opt,name=uint64,proto3" json:"uint64,omitempty"`
-	Uint32    *wrapperspb.UInt32Value `protobuf:"bytes,21,opt,name=uint32,proto3" json:"uint32,omitempty"`
-	Bool      *wrapperspb.BoolValue   `protobuf:"bytes,22,opt,name=bool,proto3" json:"bool,omitempty"`
-	String_   *wrapperspb.StringValue `protobuf:"bytes,23,opt,name=string,proto3" json:"string,omitempty"`
-	Bytes     *wrapperspb.BytesValue  `protobuf:"bytes,24,opt,name=bytes,proto3" json:"bytes,omitempty"`
-	Map       map[string]string       `protobuf:"bytes,25,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Id          int64                   `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+	NoOne       string                  `protobuf:"bytes,2,opt,name=no_one,json=numberOne,proto3" json:"no_one,omitempty"`
+	Simple      *Simple                 `protobuf:"bytes,3,opt,name=simple,json=very_simple,proto3" json:"simple,omitempty"`
+	Simples     []string                `protobuf:"bytes,4,rep,name=simples,proto3" json:"simples,omitempty"`
+	B           bool                    `protobuf:"varint,5,opt,name=b,proto3" json:"b,omitempty"`
+	Sex         Sex                     `protobuf:"varint,6,opt,name=sex,proto3,enum=testproto.Sex" json:"sex,omitempty"`
+	Age         int32                   `protobuf:"varint,7,opt,name=age,proto3" json:"age,omitempty"`
+	A           uint32                  `protobuf:"varint,8,opt,name=a,proto3" json:"a,omitempty"`
+	Count       uint64                  `protobuf:"varint,9,opt,name=count,proto3" json:"count,omitempty"`
+	Price       float32                 `protobuf:"fixed32,10,opt,name=price,proto3" json:"price,omitempty"`
+	D           float64                 `protobuf:"fixed64,11,opt,name=d,proto3" json:"d,omitempty"`
+	Byte        []byte                  `protobuf:"bytes,12,opt,name=byte,proto3" json:"byte,omitempty"`
+	Timestamp   *timestamppb.Timestamp  `protobuf:"bytes,13,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+	Duration    *durationpb.Duration    `protobuf:"bytes,14,opt,name=duration,proto3" json:"duration,omitempty"`
+	Field       *fieldmaskpb.FieldMask  `protobuf:"bytes,15,opt,name=field,proto3" json:"field,omitempty"`
+	Double      *wrapperspb.DoubleValue `protobuf:"bytes,16,opt,name=double,proto3" json:"double,omitempty"`
+	Float       *wrapperspb.FloatValue  `protobuf:"bytes,17,opt,name=float,proto3" json:"float,omitempty"`
+	Int64       *wrapperspb.Int64Value  `protobuf:"bytes,18,opt,name=int64,proto3" json:"int64,omitempty"`
+	Int32       *wrapperspb.Int32Value  `protobuf:"bytes,19,opt,name=int32,proto3" json:"int32,omitempty"`
+	Uint64      *wrapperspb.UInt64Value `protobuf:"bytes,20,opt,name=uint64,proto3" json:"uint64,omitempty"`
+	Uint32      *wrapperspb.UInt32Value `protobuf:"bytes,21,opt,name=uint32,proto3" json:"uint32,omitempty"`
+	Bool        *wrapperspb.BoolValue   `protobuf:"bytes,22,opt,name=bool,proto3" json:"bool,omitempty"`
+	String_     *wrapperspb.StringValue `protobuf:"bytes,23,opt,name=string,proto3" json:"string,omitempty"`
+	Bytes       *wrapperspb.BytesValue  `protobuf:"bytes,24,opt,name=bytes,proto3" json:"bytes,omitempty"`
+	Map         map[string]string       `protobuf:"bytes,25,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	MapInt64Key map[int64]string        `protobuf:"bytes,26,rep,name=map_int64_key,proto3" json:"map_int64_key,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
 }
 
 func (x *Complex) Reset() {
@@ -311,6 +312,13 @@ func (x *Complex) GetMap() map[string]string {
 	return nil
 }
 
+func (x *Complex) GetMapInt64Key() map[int64]string {
+	if x != nil {
+		return x.MapInt64Key
+	}
+	return nil
+}
+
 type Simple struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -370,7 +378,7 @@ var file_complex_proto_rawDesc = []byte{
 	0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65,
 	0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67,
 	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77,
-	0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfa, 0x07,
+	0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x09,
 	0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
 	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x06, 0x6e, 0x6f, 0x5f,
 	0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x62, 0x65,
@@ -431,20 +439,29 @@ var file_complex_proto_rawDesc = []byte{
 	0x74, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x03, 0x6d, 0x61, 0x70, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b,
 	0x32, 0x1b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d,
 	0x70, 0x6c, 0x65, 0x78, 0x2e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x6d,
-	0x61, 0x70, 0x1a, 0x36, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
-	0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
-	0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x26, 0x0a, 0x06, 0x53, 0x69,
-	0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e,
-	0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65,
-	0x6e, 0x74, 0x2a, 0x19, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x12, 0x07, 0x0a, 0x03, 0x6d, 0x61, 0x6e,
-	0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x77, 0x6f, 0x6d, 0x61, 0x6e, 0x10, 0x01, 0x42, 0x57, 0x5a,
-	0x55, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b,
-	0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6d, 0x64,
-	0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x68,
-	0x74, 0x74, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x6e, 0x63,
-	0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x2f, 0x3b, 0x63,
-	0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x61, 0x70, 0x12, 0x49, 0x0a, 0x0d, 0x6d, 0x61, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f,
+	0x6b, 0x65, 0x79, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x65, 0x73, 0x74,
+	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x2e, 0x4d, 0x61,
+	0x70, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d,
+	0x6d, 0x61, 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x6b, 0x65, 0x79, 0x1a, 0x36, 0x0a,
+	0x08, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
+	0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
+	0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x4d, 0x61, 0x70, 0x49, 0x6e, 0x74, 0x36,
+	0x34, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
+	0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
+	0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x26, 0x0a, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x12,
+	0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2a, 0x19, 0x0a,
+	0x03, 0x73, 0x65, 0x78, 0x12, 0x07, 0x0a, 0x03, 0x6d, 0x61, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a,
+	0x05, 0x77, 0x6f, 0x6d, 0x61, 0x6e, 0x10, 0x01, 0x42, 0x57, 0x5a, 0x55, 0x67, 0x69, 0x74, 0x68,
+	0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
+	0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x63, 0x6d, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74,
+	0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x69,
+	0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67,
+	0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x2f, 0x3b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
+	0x78, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -460,46 +477,48 @@ func file_complex_proto_rawDescGZIP() []byte {
 }
 
 var file_complex_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_complex_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_complex_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
 var file_complex_proto_goTypes = []interface{}{
 	(Sex)(0),                       // 0: testproto.sex
 	(*Complex)(nil),                // 1: testproto.Complex
 	(*Simple)(nil),                 // 2: testproto.Simple
 	nil,                            // 3: testproto.Complex.MapEntry
-	(*timestamppb.Timestamp)(nil),  // 4: google.protobuf.Timestamp
-	(*durationpb.Duration)(nil),    // 5: google.protobuf.Duration
-	(*fieldmaskpb.FieldMask)(nil),  // 6: google.protobuf.FieldMask
-	(*wrapperspb.DoubleValue)(nil), // 7: google.protobuf.DoubleValue
-	(*wrapperspb.FloatValue)(nil),  // 8: google.protobuf.FloatValue
-	(*wrapperspb.Int64Value)(nil),  // 9: google.protobuf.Int64Value
-	(*wrapperspb.Int32Value)(nil),  // 10: google.protobuf.Int32Value
-	(*wrapperspb.UInt64Value)(nil), // 11: google.protobuf.UInt64Value
-	(*wrapperspb.UInt32Value)(nil), // 12: google.protobuf.UInt32Value
-	(*wrapperspb.BoolValue)(nil),   // 13: google.protobuf.BoolValue
-	(*wrapperspb.StringValue)(nil), // 14: google.protobuf.StringValue
-	(*wrapperspb.BytesValue)(nil),  // 15: google.protobuf.BytesValue
+	nil,                            // 4: testproto.Complex.MapInt64KeyEntry
+	(*timestamppb.Timestamp)(nil),  // 5: google.protobuf.Timestamp
+	(*durationpb.Duration)(nil),    // 6: google.protobuf.Duration
+	(*fieldmaskpb.FieldMask)(nil),  // 7: google.protobuf.FieldMask
+	(*wrapperspb.DoubleValue)(nil), // 8: google.protobuf.DoubleValue
+	(*wrapperspb.FloatValue)(nil),  // 9: google.protobuf.FloatValue
+	(*wrapperspb.Int64Value)(nil),  // 10: google.protobuf.Int64Value
+	(*wrapperspb.Int32Value)(nil),  // 11: google.protobuf.Int32Value
+	(*wrapperspb.UInt64Value)(nil), // 12: google.protobuf.UInt64Value
+	(*wrapperspb.UInt32Value)(nil), // 13: google.protobuf.UInt32Value
+	(*wrapperspb.BoolValue)(nil),   // 14: google.protobuf.BoolValue
+	(*wrapperspb.StringValue)(nil), // 15: google.protobuf.StringValue
+	(*wrapperspb.BytesValue)(nil),  // 16: google.protobuf.BytesValue
 }
 var file_complex_proto_depIdxs = []int32{
 	2,  // 0: testproto.Complex.simple:type_name -> testproto.Simple
 	0,  // 1: testproto.Complex.sex:type_name -> testproto.sex
-	4,  // 2: testproto.Complex.timestamp:type_name -> google.protobuf.Timestamp
-	5,  // 3: testproto.Complex.duration:type_name -> google.protobuf.Duration
-	6,  // 4: testproto.Complex.field:type_name -> google.protobuf.FieldMask
-	7,  // 5: testproto.Complex.double:type_name -> google.protobuf.DoubleValue
-	8,  // 6: testproto.Complex.float:type_name -> google.protobuf.FloatValue
-	9,  // 7: testproto.Complex.int64:type_name -> google.protobuf.Int64Value
-	10, // 8: testproto.Complex.int32:type_name -> google.protobuf.Int32Value
-	11, // 9: testproto.Complex.uint64:type_name -> google.protobuf.UInt64Value
-	12, // 10: testproto.Complex.uint32:type_name -> google.protobuf.UInt32Value
-	13, // 11: testproto.Complex.bool:type_name -> google.protobuf.BoolValue
-	14, // 12: testproto.Complex.string:type_name -> google.protobuf.StringValue
-	15, // 13: testproto.Complex.bytes:type_name -> google.protobuf.BytesValue
+	5,  // 2: testproto.Complex.timestamp:type_name -> google.protobuf.Timestamp
+	6,  // 3: testproto.Complex.duration:type_name -> google.protobuf.Duration
+	7,  // 4: testproto.Complex.field:type_name -> google.protobuf.FieldMask
+	8,  // 5: testproto.Complex.double:type_name -> google.protobuf.DoubleValue
+	9,  // 6: testproto.Complex.float:type_name -> google.protobuf.FloatValue
+	10, // 7: testproto.Complex.int64:type_name -> google.protobuf.Int64Value
+	11, // 8: testproto.Complex.int32:type_name -> google.protobuf.Int32Value
+	12, // 9: testproto.Complex.uint64:type_name -> google.protobuf.UInt64Value
+	13, // 10: testproto.Complex.uint32:type_name -> google.protobuf.UInt32Value
+	14, // 11: testproto.Complex.bool:type_name -> google.protobuf.BoolValue
+	15, // 12: testproto.Complex.string:type_name -> google.protobuf.StringValue
+	16, // 13: testproto.Complex.bytes:type_name -> google.protobuf.BytesValue
 	3,  // 14: testproto.Complex.map:type_name -> testproto.Complex.MapEntry
-	15, // [15:15] is the sub-list for method output_type
-	15, // [15:15] is the sub-list for method input_type
-	15, // [15:15] is the sub-list for extension type_name
-	15, // [15:15] is the sub-list for extension extendee
-	0,  // [0:15] is the sub-list for field type_name
+	4,  // 15: testproto.Complex.map_int64_key:type_name -> testproto.Complex.MapInt64KeyEntry
+	16, // [16:16] is the sub-list for method output_type
+	16, // [16:16] is the sub-list for method input_type
+	16, // [16:16] is the sub-list for extension type_name
+	16, // [16:16] is the sub-list for extension extendee
+	0,  // [0:16] is the sub-list for field type_name
 }
 
 func init() { file_complex_proto_init() }
@@ -539,7 +558,7 @@ func file_complex_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_complex_proto_rawDesc,
 			NumEnums:      1,
-			NumMessages:   3,
+			NumMessages:   4,
 			NumExtensions: 0,
 			NumServices:   0,
 		},
diff --git a/internal/testdata/complex/complex.proto b/internal/testdata/complex/complex.proto
index 64e5c448..4e20d5a3 100644
--- a/internal/testdata/complex/complex.proto
+++ b/internal/testdata/complex/complex.proto
@@ -40,6 +40,7 @@ message Complex {
   google.protobuf.BytesValue bytes = 24;
 
   map<string,string> map = 25;
+  map<int64,string> map_int64_key = 26 [json_name = "map_int64_key"];
 }
 
 message Simple {
diff --git a/internal/testdata/complex/generate.go b/internal/testdata/complex/generate.go
new file mode 100644
index 00000000..c3cfd9fb
--- /dev/null
+++ b/internal/testdata/complex/generate.go
@@ -0,0 +1,3 @@
+package complex
+
+//go:generate protoc -I . --go_out=paths=source_relative:. ./complex.proto
diff --git a/transport/http/context_test.go b/transport/http/context_test.go
index 6cae1b9a..8cc79da0 100644
--- a/transport/http/context_test.go
+++ b/transport/http/context_test.go
@@ -100,6 +100,34 @@ func TestContextResponse(t *testing.T) {
 	}
 }
 
+func TestResponseUnwrap(t *testing.T) {
+	res := httptest.NewRecorder()
+	f := func(rw http.ResponseWriter, r *http.Request, a interface{}) error {
+		u, ok := rw.(interface {
+			Unwrap() http.ResponseWriter
+		})
+		if !ok {
+			return errors.New("can not unwrap")
+		}
+		w := u.Unwrap()
+		if !reflect.DeepEqual(w, res) {
+			return errors.New("underlying response writer not equal")
+		}
+		return nil
+	}
+
+	w := wrapper{
+		router: &Router{srv: &Server{enc: f}},
+		req:    nil,
+		res:    res,
+		w:      responseWriter{200, res},
+	}
+	err := w.Result(200, "ok")
+	if err != nil {
+		t.Errorf("expected %v, got %v", nil, err)
+	}
+}
+
 func TestContextBindQuery(t *testing.T) {
 	w := wrapper{
 		router: testRouter,