@@ -64,7 +64,6 @@ func TestWebSocketProxy(t *testing.T) {
64 if err != nil {
64 if err != nil {
65 t.Fatalf("err %s", err)
65 t.Fatalf("err %s", err)
70 backend := httptest.NewServer(&handler)
69 backend := httptest.NewServer(&handler)
@@ -426,7 +425,7 @@ func TestBasicAuthPassword(t *testing.T) {
426 if rw.Code >= 400 {
425 if rw.Code >= 400 {
427 t.Fatalf("expected 3xx got %d", rw.Code)
426 t.Fatalf("expected 3xx got %d", rw.Code)
429− cookie := rw.HeaderMap["Set-Cookie"][1]
428+ cookie := rw.Header().Values("Set-Cookie")[1]
431 cookieName := proxy.CookieName
430 cookieName := proxy.CookieName
432 var value string
431 var value string
@@ -614,7 +613,7 @@ func (patTest *PassAccessTokenTest) getCallbackEndpoint() (httpCode int,
615 req.AddCookie(patTest.proxy.MakeCSRFCookie(req, "nonce", time.Hour, time.Now()))
614 req.AddCookie(patTest.proxy.MakeCSRFCookie(req, "nonce", time.Hour, time.Now()))
616 patTest.proxy.ServeHTTP(rw, req)
615 patTest.proxy.ServeHTTP(rw, req)
617− return rw.Code, rw.HeaderMap["Set-Cookie"][1]
616+ return rw.Code, rw.Header().Values("Set-Cookie")[1]
620// getEndpointWithCookie makes a requests againt the oauthproxy with passed requestPath
619// getEndpointWithCookie makes a requests againt the oauthproxy with passed requestPath
@@ -691,7 +690,7 @@ func TestStaticProxyUpstream(t *testing.T) {
692 assert.NotEqual(t, nil, cookie)
691 assert.NotEqual(t, nil, cookie)
694− // Now we make a regular request againts the upstream proxy; And validate
693+ // Now we make a regular request against the upstream proxy; And validate
695 // the returned status code through the static proxy.
694 // the returned status code through the static proxy.
696 code, payload := patTest.getEndpointWithCookie(cookie, "/static-proxy")
695 code, payload := patTest.getEndpointWithCookie(cookie, "/static-proxy")
697 if code != 200 {
696 if code != 200 {
@@ -824,8 +823,6 @@ type ProcessCookieTest struct {
824 proxy *OAuthProxy
823 proxy *OAuthProxy
825 rw *httptest.ResponseRecorder
824 rw *httptest.ResponseRecorder
826 req *http.Request
825 req *http.Request
827− provider TestProvider
829 validateUser bool
826 validateUser bool
@@ -910,7 +907,7 @@ func TestProcessCookieNoCookieError(t *testing.T) {
910 pcTest := NewProcessCookieTestWithDefaults()
907 pcTest := NewProcessCookieTestWithDefaults()
912 session, err := pcTest.LoadCookiedSession()
909 session, err := pcTest.LoadCookiedSession()
913− assert.Equal(t, "Cookie \"_oauth2_proxy\" not present", err.Error())
910+ assert.Equal(t, "cookie \"_oauth2_proxy\" not present", err.Error())
914 if session != nil {
911 if session != nil {
915 t.Errorf("expected nil session. got %#v", session)
912 t.Errorf("expected nil session. got %#v", session)
@@ -1072,8 +1069,8 @@ func TestAuthOnlyEndpointSetXAuthRequestHeaders(t *testing.T) {
1073 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1070 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1074 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1071 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1075− assert.Equal(t, "oauth_user", pcTest.rw.HeaderMap["X-Auth-Request-User"][0])
1072+ assert.Equal(t, "oauth_user", pcTest.rw.Header().Get("X-Auth-Request-User"))
1076− assert.Equal(t, "oauth_user@example.com", pcTest.rw.HeaderMap["X-Auth-Request-Email"][0])
1073+ assert.Equal(t, "oauth_user@example.com", pcTest.rw.Header().Get("X-Auth-Request-Email"))
1079func TestAuthOnlyEndpointSetBasicAuthTrueRequestHeaders(t *testing.T) {
1076func TestAuthOnlyEndpointSetBasicAuthTrueRequestHeaders(t *testing.T) {
@@ -1103,10 +1100,10 @@ func TestAuthOnlyEndpointSetBasicAuthTrueRequestHeaders(t *testing.T) {
1104 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1101 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1105 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1102 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1106− assert.Equal(t, "oauth_user", pcTest.rw.HeaderMap["X-Auth-Request-User"][0])
1103+ assert.Equal(t, "oauth_user", pcTest.rw.Header().Values("X-Auth-Request-User")[0])
1107− assert.Equal(t, "oauth_user@example.com", pcTest.rw.HeaderMap["X-Auth-Request-Email"][0])
1104+ assert.Equal(t, "oauth_user@example.com", pcTest.rw.Header().Values("X-Auth-Request-Email")[0])
1108 expectedHeader := "Basic " + base64.StdEncoding.EncodeToString([]byte("oauth_user:"+pcTest.opts.BasicAuthPassword))
1105 expectedHeader := "Basic " + base64.StdEncoding.EncodeToString([]byte("oauth_user:"+pcTest.opts.BasicAuthPassword))
1109− assert.Equal(t, expectedHeader, pcTest.rw.HeaderMap["Authorization"][0])
1106+ assert.Equal(t, expectedHeader, pcTest.rw.Header().Values("Authorization")[0])
1112func TestAuthOnlyEndpointSetBasicAuthFalseRequestHeaders(t *testing.T) {
1109func TestAuthOnlyEndpointSetBasicAuthFalseRequestHeaders(t *testing.T) {
@@ -1136,9 +1133,9 @@ func TestAuthOnlyEndpointSetBasicAuthFalseRequestHeaders(t *testing.T) {
1137 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1134 pcTest.proxy.ServeHTTP(pcTest.rw, pcTest.req)
1138 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1135 assert.Equal(t, http.StatusAccepted, pcTest.rw.Code)
1139− assert.Equal(t, "oauth_user", pcTest.rw.HeaderMap["X-Auth-Request-User"][0])
1136+ assert.Equal(t, "oauth_user", pcTest.rw.Header().Values("X-Auth-Request-User")[0])
1140− assert.Equal(t, "oauth_user@example.com", pcTest.rw.HeaderMap["X-Auth-Request-Email"][0])
1137+ assert.Equal(t, "oauth_user@example.com", pcTest.rw.Header().Values("X-Auth-Request-Email")[0])
1141− assert.Equal(t, 0, len(pcTest.rw.HeaderMap["Authorization"]), "should not have Authorization header entries")
1138+ assert.Equal(t, 0, len(pcTest.rw.Header().Values("Authorization")), "should not have Authorization header entries")
1144func TestAuthSkippedForPreflightRequests(t *testing.T) {
1141func TestAuthSkippedForPreflightRequests(t *testing.T) {
@@ -1462,8 +1459,7 @@ type NoOpKeySet struct {
1462func (NoOpKeySet) VerifySignature(ctx context.Context, jwt string) (payload []byte, err error) {
1459func (NoOpKeySet) VerifySignature(ctx context.Context, jwt string) (payload []byte, err error) {
1463 splitStrings := strings.Split(jwt, ".")
1460 splitStrings := strings.Split(jwt, ".")
1464 payloadString := splitStrings[1]
1461 payloadString := splitStrings[1]
1465− jsonString, err := base64.RawURLEncoding.DecodeString(payloadString)
1462+ return base64.RawURLEncoding.DecodeString(payloadString)
1466− return []byte(jsonString), err
1469func TestGetJwtSession(t *testing.T) {
1465func TestGetJwtSession(t *testing.T) {