Skip to content

Commit 637e34a

Browse files
committed
fix linting
1 parent 6b23db7 commit 637e34a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

headerforwarder/forwarder_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ type mockInvoker struct {
6464
err error
6565
}
6666

67-
func (m *mockInvoker) Invoke(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error {
67+
func (m *mockInvoker) Invoke(
68+
ctx context.Context,
69+
method string,
70+
req,
71+
reply interface{},
72+
cc *grpc.ClientConn,
73+
opts ...grpc.CallOption,
74+
) error {
6875
m.LastRequestMD, _ = metadata.FromOutgoingContext(ctx)
6976

7077
// add response metadata to pointer from call option
@@ -212,9 +219,11 @@ func TestRoundTrip(t *testing.T) {
212219

213220
testReq := newRequest(ctx, nil)
214221

215-
_, err := hf.RoundTrip(testReq)
222+
response, err := hf.RoundTrip(testReq)
216223
assert.Equal(t, test.ExpectedError, err)
217224

225+
defer response.Body.Close()
226+
218227
outgoingReq := mockTransport.(*fakeTransport).LastRequest
219228
capturedHeaders, _ := hf.GetResponseHeaders(requestID)
220229

headerforwarder/response_writer_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestWriteHeader(t *testing.T) {
4343
hfrw.WriteHeader(200)
4444

4545
result := writer.Result()
46+
defer result.Body.Close()
4647
assert.Equal(t, 200, result.StatusCode)
4748
}
4849

@@ -53,6 +54,7 @@ func TestWriteHeaderAddsHeaders(t *testing.T) {
5354
hfrw.WriteHeader(200)
5455

5556
result := writer.Result()
57+
defer result.Body.Close()
5658
assert.Equal(t, 200, result.StatusCode)
5759
assert.Equal(t, mockHeader.Values("test-header"), result.Header.Values("test-header"))
5860
}
@@ -66,6 +68,7 @@ func TestWriteAddsHeaders(t *testing.T) {
6668
assert.Nil(t, err)
6769

6870
result := writer.Result()
71+
defer result.Body.Close()
6972
assert.Equal(t, 200, result.StatusCode)
7073
assert.Equal(t, mockHeader.Values("test-header"), result.Header.Values("test-header"))
7174
}

0 commit comments

Comments
 (0)