mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-24 20:18:13 +02:00
authenticate: refactor middleware, logging, and tests (#30)
- Abstract remaining middleware from authenticate into internal. - Use middleware chaining in authenticate. - Standardize naming of Request and ResponseWriter to match std lib. - Add healthcheck / ping as a middleware. - Internalized wraped_writer package adapted from goji/middleware. - Fixed indirection issue with reverse proxy map.
This commit is contained in:
parent
b9c298d278
commit
7e1d1a7896
21 changed files with 768 additions and 397 deletions
33
internal/middleware/wrap_writer_test.go
Normal file
33
internal/middleware/wrap_writer_test.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFlushWriterRemembersWroteHeaderWhenFlushed(t *testing.T) {
|
||||
f := &flushWriter{basicWriter{ResponseWriter: httptest.NewRecorder()}}
|
||||
f.Flush()
|
||||
|
||||
if !f.wroteHeader {
|
||||
t.Fatal("want Flush to have set wroteHeader=true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHttpFancyWriterRemembersWroteHeaderWhenFlushed(t *testing.T) {
|
||||
f := &httpFancyWriter{basicWriter{ResponseWriter: httptest.NewRecorder()}}
|
||||
f.Flush()
|
||||
|
||||
if !f.wroteHeader {
|
||||
t.Fatal("want Flush to have set wroteHeader=true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHttp2FancyWriterRemembersWroteHeaderWhenFlushed(t *testing.T) {
|
||||
f := &http2FancyWriter{basicWriter{ResponseWriter: httptest.NewRecorder()}}
|
||||
f.Flush()
|
||||
|
||||
if !f.wroteHeader {
|
||||
t.Fatal("want Flush to have set wroteHeader=true")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue