Move Logging to Middleware Package (#1070)

* Use a specialized ResponseWriter in middleware

* Track User & Upstream in RequestScope

* Wrap responses in our custom ResponseWriter

* Add tests for logging middleware

* Inject upstream metadata into request scope

* Use custom ResponseWriter only in logging middleware

* Assume RequestScope is never nil
This commit is contained in:
Nick Meves
2021-03-06 17:27:16 +00:00
committed by GitHub
parent 220b3708fc
commit 602dac7852
16 changed files with 337 additions and 266 deletions
+3
View File
@@ -34,6 +34,9 @@ type RequestScope struct {
// SessionRevalidated indicates whether the session has been revalidated since
// it was loaded or not.
SessionRevalidated bool
// Upstream tracks which upstream was used for this request
Upstream string
}
// GetRequestScope returns the current request scope from the given request