-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Get method string from stream #1588
Conversation
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
I signed it. |
stream.go
Outdated
@@ -655,3 +655,12 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { | |||
} | |||
return nil | |||
} | |||
|
|||
// GetMethodFromStream returns the method string that the input stream is used for. |
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.
The returned string is in the format of "/service/method".
fix #1549 |
test/end2end_test.go
Outdated
defer te.tearDown() | ||
_ = te.clientConn().Invoke(context.Background(), "foo/bar", nil, nil) | ||
if !ok || method != "foo/bar" { | ||
t.Fatalf("Invoke with method \"foo/bar\", got %s, %v, want \"foo/bar\", true", method, ok) |
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: define a testing const, and print %q
to avoid escaping "
s.
const testMethod = "/package.service/method"
if !ok || method != testMethod {
 t.Fatalf("Invoke with method %q, got %q, %v, want %q, true", testMethod, method, ok, testMethod)
}
fix #1549