Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
potterbm-cb committed Nov 27, 2024
1 parent 6b23db7 commit 637e34a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions headerforwarder/forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ type mockInvoker struct {
err error
}

func (m *mockInvoker) Invoke(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error {
func (m *mockInvoker) Invoke(
ctx context.Context,
method string,
req,
reply interface{},
cc *grpc.ClientConn,
opts ...grpc.CallOption,
) error {
m.LastRequestMD, _ = metadata.FromOutgoingContext(ctx)

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

testReq := newRequest(ctx, nil)

_, err := hf.RoundTrip(testReq)
response, err := hf.RoundTrip(testReq)
assert.Equal(t, test.ExpectedError, err)

defer response.Body.Close()

outgoingReq := mockTransport.(*fakeTransport).LastRequest
capturedHeaders, _ := hf.GetResponseHeaders(requestID)

Expand Down
3 changes: 3 additions & 0 deletions headerforwarder/response_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestWriteHeader(t *testing.T) {
hfrw.WriteHeader(200)

result := writer.Result()
defer result.Body.Close()
assert.Equal(t, 200, result.StatusCode)
}

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

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

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

0 comments on commit 637e34a

Please sign in to comment.