Codebase list golang-github-go-kit-kit / 5550f4e
Fix nil context being passed to function shubhendra authored 2 years ago Mark Sagi-Kazar committed 1 year, 6 months ago
1 changed file(s) with 3 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
00 package proto
11
22 import (
3 "context"
34 "io/ioutil"
45 "net/http"
56 "net/http/httptest"
1314
1415 r := httptest.NewRequest(http.MethodGet, "/cat", nil)
1516
16 err := EncodeProtoRequest(nil, r, cat)
17 err := EncodeProtoRequest(context.TODO(), r, cat)
1718 if err != nil {
1819 t.Errorf("expected no encoding errors but got: %s", err)
1920 return
5051
5152 wr := httptest.NewRecorder()
5253
53 err := EncodeProtoResponse(nil, wr, cat)
54 err := EncodeProtoResponse(context.TODO(), wr, cat)
5455 if err != nil {
5556 t.Errorf("expected no encoding errors but got: %s", err)
5657 return