-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set RPC-Thrift-Envelope HTTP header for Thrift requests #205
Conversation
See yarpc/yarpc-go/issues/741 for more details. This is part 1 in making yab work with YARPC regardless of envelope options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just nits
envelope := r.Header.Get(transport.HTTPThriftEnvelopeheader) | ||
assert.Equal(t, tt.wantEnvelopeHeader, envelope) | ||
})) | ||
defer server.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Because this isn't a function, all the servers will keep running until the test exits. I would push this into an anonymous function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May as well add a t.Run wrapper in the loop.
@@ -786,11 +787,17 @@ func TestWithTransportSerializer(t *testing.T) { | |||
Type: wire.Call, | |||
Value: wire.NewValueStruct(wire.Struct{}), | |||
}), | |||
wantTransportHeaders: map[string]string{ | |||
"RPC-Thrift-Envelope": "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pretty sure that the canonical form of the header key (as defined by net/http) is Rpc-Thrift-Envelope
.
You could also just use https://golang.org/pkg/net/http/#CanonicalHeaderKey
envelope := r.Header.Get(transport.HTTPThriftEnvelopeheader) | ||
assert.Equal(t, tt.wantEnvelopeHeader, envelope) | ||
})) | ||
defer server.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May as well add a t.Run wrapper in the loop.
@prashantv what is the status on this? |
I didn't want to merge this without making sure we were doing the same thing in YARPC. I had a WIP PR in YARPC: The YARPC request object does not have the flexibility to implement this, from the above PR:
I'm not planning to work on this in YARPC till the above issue is resolved. |
See yarpc/yarpc-go/issues/741 for more details. This is the first step in making
yab work with YARPC for HTTP+Thrift transparently regardless of whether the request is enveloped or not.