Skip to content

Commit 647de05

Browse files
Long LeLong Le
Long Le
authored and
Long Le
committed
removed request uri template option
1 parent 1ce6d4d commit 647de05

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

gateway/middleware.go

-2
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ func (t *BaseMiddleware) recordAccessLog(req *http.Request, resp *http.Response,
456456
accessLog.WithLatency(latency)
457457
case "request":
458458
accessLog.WithRequest(req)
459-
case "requesturi":
460-
accessLog.WithRequestURI(req)
461459
case "response":
462460
accessLog.WithResponse(resp)
463461
case "upstream":

internal/httputil/accesslog/access_log.go

-9
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@ func (a *Record) WithRequest(req *http.Request) *Record {
7171
return a
7272
}
7373

74-
// WithRequestURI sets the request URI of the Record. May contain sensitive data such as
75-
// query parameters etc.
76-
func (a *Record) WithRequestURI(req *http.Request) *Record {
77-
if req != nil {
78-
a.fields["request_uri"] = req.RequestURI
79-
}
80-
return a
81-
}
82-
8374
// WithResponse sets the response data of the Record.
8475
func (a *Record) WithResponse(resp *http.Response) *Record {
8576
if resp != nil {

internal/httputil/accesslog/access_log_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestNewRecordField(t *testing.T) {
6969
StatusCode: http.StatusOK,
7070
}
7171

72-
record := NewRecord().WithClientIP(req).WithLatency(latency).WithRequest(req).WithRequestURI(req).WithResponse(resp).WithUpstreamAddress(req).WithUpstreamURI(req).Fields()
72+
record := NewRecord().WithClientIP(req).WithLatency(latency).WithRequest(req).WithResponse(resp).WithUpstreamAddress(req).WithUpstreamURI(req).Fields()
7373

7474
assert.Equal(t, "access-log", record["prefix"])
7575

@@ -87,9 +87,6 @@ func TestNewRecordField(t *testing.T) {
8787
assert.Equal(t, "HTTP/1.1", record["protocol"])
8888
assert.Equal(t, "user-agent", record["user_agent"])
8989

90-
// WithRequest URI
91-
assert.Equal(t, "http://example.com/path?userid=1", record["request_uri"])
92-
9390
// WithResponse
9491
assert.Equal(t, http.StatusOK, record["status_code"])
9592

0 commit comments

Comments
 (0)