Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

prashantv
Copy link
Contributor

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.

See yarpc/yarpc-go/issues/741 for more details. This is part 1 in making
yab work with YARPC regardless of envelope options.
Copy link
Contributor

@abhinav abhinav left a 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()
Copy link
Contributor

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.

Copy link
Contributor

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",
Copy link
Contributor

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()
Copy link
Contributor

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.

@bufdev
Copy link
Contributor

bufdev commented Oct 26, 2017

@prashantv what is the status on this?

@prashantv
Copy link
Contributor Author

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:
yarpc/yarpc-go#1097

The YARPC request object does not have the flexibility to implement this, from the above PR:

We need to come up with a good approach to pass some information from the encoding to the transport on the request. I added an arbitrary TransportHeaders map[string]string, but I'm not sure if that's the right approach.

I'm not planning to work on this in YARPC till the above issue is resolved.

@prashantv prashantv closed this Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants