Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: server/prpc/decoding_test.go

Issue 1636873006: server/prpc: updated server according to protocol (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Respond to nits, escape externally-supplied strings when passed to format parameters. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/prpc/decoding.go ('k') | server/prpc/encoding.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/prpc/decoding_test.go
diff --git a/server/prpc/decoding_test.go b/server/prpc/decoding_test.go
index 05807a92c2bad1573ea779cd1ae6f15a3416c755..dd4264527b920f925d1b3c8ac7c70649b7307696 100644
--- a/server/prpc/decoding_test.go
+++ b/server/prpc/decoding_test.go
@@ -56,7 +56,7 @@ func TestDecoding(t *testing.T) {
Convey("readMessage", t, func() {
var msg HelloRequest
- read := func(contentType string, body []byte) error {
+ read := func(contentType string, body []byte) *protocolError {
req := &http.Request{
Body: ioutil.NopCloser(bytes.NewBuffer(body)),
Header: http.Header{},
@@ -85,7 +85,7 @@ func TestDecoding(t *testing.T) {
Convey("malformed body", func() {
err := read(mtPRPCBinary, []byte{0})
So(err, ShouldNotBeNil)
- So(ErrorStatus(err), ShouldEqual, http.StatusBadRequest)
+ So(err.status, ShouldEqual, http.StatusBadRequest)
})
Convey("empty body", func() {
err := read(mtPRPCBinary, nil)
@@ -104,11 +104,12 @@ func TestDecoding(t *testing.T) {
Convey("malformed body", func() {
err := read(mtPRPCJSNOPB, []byte{0})
So(err, ShouldNotBeNil)
- So(ErrorStatus(err), ShouldEqual, http.StatusBadRequest)
+ So(err.status, ShouldEqual, http.StatusBadRequest)
})
Convey("empty body", func() {
err := read(mtPRPCJSNOPB, nil)
- So(err, ShouldBeNil)
+ So(err, ShouldNotBeNil)
+ So(err.status, ShouldEqual, http.StatusBadRequest)
})
})
@@ -120,7 +121,7 @@ func TestDecoding(t *testing.T) {
Convey("malformed body", func() {
err := read(mtPRPCText, []byte{0})
So(err, ShouldNotBeNil)
- So(ErrorStatus(err), ShouldEqual, http.StatusBadRequest)
+ So(err.status, ShouldEqual, http.StatusBadRequest)
})
Convey("empty body", func() {
err := read(mtPRPCText, nil)
@@ -131,7 +132,7 @@ func TestDecoding(t *testing.T) {
Convey("unsupported media type", func() {
err := read("blah", nil)
So(err, ShouldNotBeNil)
- So(ErrorStatus(err), ShouldEqual, http.StatusUnsupportedMediaType)
+ So(err.status, ShouldEqual, http.StatusUnsupportedMediaType)
})
})
« no previous file with comments | « server/prpc/decoding.go ('k') | server/prpc/encoding.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698