Fix nil context being passed to function
shubhendra authored 2 years ago
Mark Sagi-Kazar committed 1 year, 6 months ago
0 | 0 | package proto |
1 | 1 | |
2 | 2 | import ( |
3 | "context" | |
3 | 4 | "io/ioutil" |
4 | 5 | "net/http" |
5 | 6 | "net/http/httptest" |
13 | 14 | |
14 | 15 | r := httptest.NewRequest(http.MethodGet, "/cat", nil) |
15 | 16 | |
16 | err := EncodeProtoRequest(nil, r, cat) | |
17 | err := EncodeProtoRequest(context.TODO(), r, cat) | |
17 | 18 | if err != nil { |
18 | 19 | t.Errorf("expected no encoding errors but got: %s", err) |
19 | 20 | return |
50 | 51 | |
51 | 52 | wr := httptest.NewRecorder() |
52 | 53 | |
53 | err := EncodeProtoResponse(nil, wr, cat) | |
54 | err := EncodeProtoResponse(context.TODO(), wr, cat) | |
54 | 55 | if err != nil { |
55 | 56 | t.Errorf("expected no encoding errors but got: %s", err) |
56 | 57 | return |