simplify recordAPIStats wrapper for ResponseWriters (#9034)

This commit is contained in:
Harshavardhana
2020-02-24 23:15:32 +05:30
committed by GitHub
parent 4c92bec619
commit ece0d4ac53
3 changed files with 12 additions and 27 deletions

View File

@@ -538,9 +538,8 @@ func setHTTPStatsHandler(h http.Handler) http.Handler {
func (h httpStatsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
isS3Request := !strings.HasPrefix(r.URL.Path, minioReservedBucketPath)
// record s3 connection stats.
recordRequest := &recordTrafficRequest{ReadCloser: r.Body, isS3Request: isS3Request}
r.Body = recordRequest
recordResponse := &recordTrafficResponse{w, isS3Request}
r.Body = &recordTrafficRequest{ReadCloser: r.Body, isS3Request: isS3Request}
recordResponse := &recordTrafficResponse{ResponseWriter: w, isS3Request: isS3Request}
// Execute the request
h.handler.ServeHTTP(recordResponse, r)
}