-
Notifications
You must be signed in to change notification settings - Fork 3
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
allow to define a custom default response encoder #11
Conversation
Pull Request Test Coverage Report for Build 81
💛 - Coveralls |
http_test.go
Outdated
}, | ||
Body: ioutil.NopCloser(bytes.NewBuffer([]byte("OK:override"))), | ||
}) | ||
if !overrideCalled { |
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.
If override was called by the previous test but not this one, this does not fail...
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.
As long as you test the response body, is it really necessary to test overrideCalled ?
http_test.go
Outdated
URL: &url.URL{ | ||
Path: "/test/default", | ||
}, | ||
Body: ioutil.NopCloser(bytes.NewBuffer([]byte(`{}`))), |
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.
no body on GET requests => remove this line
http_test.go
Outdated
if rec.Code != 200 { | ||
t.Errorf("default HTTP response status expected: %d", rec.Code) | ||
} | ||
body := string(rec.Body.Bytes()) |
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.
body := rec.Body.String()
http_test.go
Outdated
"github.com/go-kit/kit/endpoint" | ||
) | ||
|
||
type Response struct { |
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.
Is it used ?
The default go-kit JSON encoder could be override in the configuration of kitty HTTP transport, so we don't pass the same encoder at each endpoint, but still be able to override it from the endpoint as option.