1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-17 00:17:40 +02:00

Move upstream information to request scope

This commit is contained in:
Joel Speed
2020-10-04 16:23:38 +01:00
parent 18cd045631
commit 2e72d151e2
11 changed files with 194 additions and 103 deletions

View File

@ -6,7 +6,9 @@ import (
"net/http/httptest"
"testing"
"github.com/justinas/alice"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/middleware"
"github.com/stretchr/testify/assert"
)
@ -102,7 +104,7 @@ func TestLoggingHandler_ServeHTTP(t *testing.T) {
logger.SetOutput(buf)
logger.SetReqTemplate(test.Format)
logger.SetExcludePaths(test.ExcludePaths)
h := LoggingHandler(http.HandlerFunc(handler))
h := alice.New(middleware.NewScope(), LoggingHandler).Then(http.HandlerFunc(handler))
r, _ := http.NewRequest("GET", test.Path, nil)
r.RemoteAddr = "127.0.0.1"