update handler recorder object

This commit is contained in:
ginuerzh
2024-09-15 10:51:23 +08:00
parent 69455ace9d
commit f681f7aa03
8 changed files with 108 additions and 70 deletions
+10 -7
View File
@@ -198,16 +198,19 @@ func (h *http2Handler) roundTrip(ctx context.Context, w http.ResponseWriter, req
}
ro.HTTP = &xrecorder.HTTPRecorderObject{
Host: req.Host,
Proto: req.Proto,
Scheme: req.URL.Scheme,
Method: req.Method,
URI: req.RequestURI,
RequestHeader: req.Header.Clone(),
Host: req.Host,
Proto: req.Proto,
Scheme: req.URL.Scheme,
Method: req.Method,
URI: req.RequestURI,
Request: xrecorder.HTTPRequestRecorderObject{
ContentLength: req.ContentLength,
Header: req.Header.Clone(),
},
}
defer func() {
ro.HTTP.StatusCode = resp.StatusCode
ro.HTTP.ResponseHeader = resp.Header
ro.HTTP.Response.Header = resp.Header
}()
clientID, ok := h.authenticate(ctx, w, req, resp, log)