Skip to content

Commit

Permalink
fix: getting headers for OnLog (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeixinX authored Oct 20, 2024
1 parent ec9ff43 commit 23ad00d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/pkg/filtermanager/filtermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (m *filterManager) localReply(v *api.LocalResponse, decoding bool) {
}

func (m *filterManager) DecodeHeaders(headers capi.RequestHeaderMap, endStream bool) capi.StatusType {
if !supportGettingHeadersOnLog && m.DebugModeEnabled() {
if !supportGettingHeadersOnLog {
// Ensure the headers are cached on the Go side.
headers.Get("test")
headers := &filterManagerRequestHeaderMap{
Expand Down Expand Up @@ -696,7 +696,7 @@ func (m *filterManager) DecodeTrailers(trailers capi.RequestTrailerMap) capi.Sta
}

func (m *filterManager) EncodeHeaders(headers capi.ResponseHeaderMap, endStream bool) capi.StatusType {
if !supportGettingHeadersOnLog && m.DebugModeEnabled() {
if !supportGettingHeadersOnLog {
// Ensure the headers are cached on the Go side.
headers.Get("test")
m.rspHdr = headers
Expand Down
4 changes: 2 additions & 2 deletions plugins/tests/integration/debug_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestDebugModeSlowLog(t *testing.T) {
pass := time.Since(now)
assert.Equal(t, 200, resp.StatusCode)
// delay time plus the req time
assert.True(t, pass < 55*time.Millisecond, pass)
assert.True(t, pass < 60*time.Millisecond, pass)
}

func TestDebugModeSlowLogNoPlugin(t *testing.T) {
Expand Down Expand Up @@ -243,7 +243,7 @@ func TestDebugModeSlowLogWithFiltersFromConsumer(t *testing.T) {
pass := time.Since(now)
assert.Equal(t, 200, resp.StatusCode)
// delay time plus the req time
assert.True(t, pass < 55*time.Millisecond, pass)
assert.True(t, pass < 60*time.Millisecond, pass)
},
},
}
Expand Down

0 comments on commit 23ad00d

Please sign in to comment.