Skip to content

Commit 61cb8b7

Browse files
authored
Merge branch 'dev' into change-enc-dec-error-code
2 parents f0ff598 + 31f4083 commit 61cb8b7

File tree

73 files changed

+711
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+711
-500
lines changed

CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
=======
88
## [Unreleased]
9+
### Fixed
10+
- Return correct error code for ctx Cancelled error in http outbound.
11+
### Added
12+
- Make tchannel outbound satisfy Namer interface
13+
### Changed
14+
- errors: encoding/decoding (marshalling/unmarshalling) errors are now returned as CodeInternal (13) instead of CodeInvalidArgument (3).
15+
16+
## [1.73.2] - 2024-09-09
17+
### Added
18+
- `OriginalHeader` accessor in `encoding.Call` to get an original header value for a request from context object with zero-copy, as opposed to accessing it via `OriginalHeaders()`
19+
20+
## [1.73.1] - 2024-08-26
21+
### Changed
22+
- Updated most of the dependencies in go.mod to a newer versions.
23+
- Performance improvement in the tchannel transport by reducing the number of allocations.
24+
25+
## [1.73.0] - 2024-05-31
926
- Upgraded go version to 1.21, set toolchain version.
1027
- Reverted rpc-caller-procedure value setting.
11-
- errors: encoding/decoding (marshalling/unmarshalling) errors are now returned as CodeInternal (13) instead of CodeInvalidArgument (3).
1228

1329
## [1.72.1] - 2024-03-14
1430
- tchannel: Renamed caller-procedure header from `$rpc$-caller-procedure` to `rpc-caller-procedure`.
@@ -1505,7 +1521,10 @@ This release requires regeneration of ThriftRW code.
15051521
## 0.1.0 - 2016-08-31
15061522
15071523
- Initial release.
1508-
[Unreleased]: https://github.com/yarpc/yarpc-go/compare/v1.72.1...HEAD
1524+
[Unreleased]: https://github.com/yarpc/yarpc-go/compare/v1.73.2...HEAD
1525+
[1.73.2]: https://github.com/yarpc/yarpc-go/compare/v1.73.1...1.73.2
1526+
[1.73.1]: https://github.com/yarpc/yarpc-go/compare/v1.73.0...1.73.1
1527+
[1.73.0]: https://github.com/yarpc/yarpc-go/compare/v1.72.1...1.73.0
15091528
[1.72.1]: https://github.com/yarpc/yarpc-go/compare/v1.72.0...1.72.1
15101529
[1.72.0]: https://github.com/yarpc/yarpc-go/compare/v1.71.0...v1.72.0
15111530
[1.71.0]: https://github.com/yarpc/yarpc-go/compare/v1.70.4...v1.71.0

api/encoding/call.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,21 @@ func (c *Call) Header(k string) string {
110110
return ""
111111
}
112112

113+
// OriginalHeader returns the value of the given request header provided with the
114+
// request. The getter is suitable for transport like TChannel that hides
115+
// certain headers by default eg: the ones starting with $
116+
func (c *Call) OriginalHeader(k string) string {
117+
if c == nil {
118+
return ""
119+
}
120+
121+
if v, ok := c.md.Headers().OriginalItems()[k]; ok {
122+
return v
123+
}
124+
125+
return ""
126+
}
127+
113128
// OriginalHeaders returns a copy of the given request headers provided with the request.
114129
// The header key are not canonicalized and suitable for case-sensitive transport like TChannel.
115130
func (c *Call) OriginalHeaders() map[string]string {

api/encoding/call_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestNilCall(t *testing.T) {
4343
assert.Equal(t, "", call.RoutingDelegate())
4444
assert.Equal(t, "", call.CallerProcedure())
4545
assert.Equal(t, "", call.Header("foo"))
46+
assert.Equal(t, "", call.OriginalHeader("foo"))
4647
assert.Empty(t, call.HeaderNames())
4748
assert.Nil(t, call.OriginalHeaders())
4849

@@ -76,6 +77,8 @@ func TestReadFromRequest(t *testing.T) {
7677
assert.Equal(t, "rk", call.RoutingKey())
7778
assert.Equal(t, "rd", call.RoutingDelegate())
7879
assert.Equal(t, "bar", call.Header("foo"))
80+
assert.Equal(t, "bar", call.OriginalHeader("foo"))
81+
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
7982
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
8083
assert.Equal(t, "cp", call.CallerProcedure())
8184
assert.Len(t, call.HeaderNames(), 1)
@@ -113,6 +116,8 @@ func TestReadFromRequestMeta(t *testing.T) {
113116
assert.Equal(t, "rd", call.RoutingDelegate())
114117
assert.Equal(t, "cp", call.CallerProcedure())
115118
assert.Equal(t, "bar", call.Header("foo"))
119+
assert.Equal(t, "bar", call.OriginalHeader("foo"))
120+
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
116121
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
117122
assert.Len(t, call.HeaderNames(), 1)
118123

call.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ func (c *Call) Header(k string) string {
145145
return (*encoding.Call)(c).Header(k)
146146
}
147147

148+
// OriginalHeader returns the value of the given request header provided with the
149+
// request. The getter is suitable for transport like TChannel that hides
150+
// certain headers by default eg: the ones starting with $
151+
func (c *Call) OriginalHeader(k string) string {
152+
return (*encoding.Call)(c).OriginalHeader(k)
153+
}
154+
148155
// OriginalHeaders returns a copy of the given request headers provided with the request.
149156
// The header key are not canonicalized and suitable for case-sensitive transport like TChannel.
150157
func (c *Call) OriginalHeaders() map[string]string {

call_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func TestCallFromContext(t *testing.T) {
7474
assert.Equal(t, transport.Encoding("baz"), call.Encoding())
7575
assert.Equal(t, "hello", call.Procedure())
7676
assert.Equal(t, "bar", call.Header("foo"))
77+
assert.Equal(t, "bar", call.OriginalHeader("foo"))
78+
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
7779
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
7880
assert.Equal(t, []string{"foo"}, call.HeaderNames())
7981
assert.Equal(t, "one", call.ShardKey())

compressor/grpc/grpc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ package yarpcgrpccompressor_test
2323
import (
2424
"testing"
2525

26-
"go.uber.org/yarpc/compressor/grpc"
27-
"go.uber.org/yarpc/compressor/gzip"
26+
yarpcgrpccompressor "go.uber.org/yarpc/compressor/grpc"
27+
yarpcgzip "go.uber.org/yarpc/compressor/gzip"
2828
"google.golang.org/grpc/encoding"
2929
)
3030

compressor/gzip/gzip_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
"github.com/stretchr/testify/assert"
3131
"github.com/stretchr/testify/require"
32-
"go.uber.org/yarpc/compressor/gzip"
32+
yarpcgzip "go.uber.org/yarpc/compressor/gzip"
3333
)
3434

3535
// This should be compressible:

compressor/snappy/snappy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
"github.com/stretchr/testify/assert"
2929
"github.com/stretchr/testify/require"
30-
"go.uber.org/yarpc/compressor/snappy"
30+
yarpcsnappy "go.uber.org/yarpc/compressor/snappy"
3131
)
3232

3333
// This should be compressible:

encoding/protobuf/internal/testpb/test.pb.go

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

encoding/protobuf/internal/testpb/v2/test.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)