mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 19:06:33 +02:00
- 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.
33 lines
777 B
Go
33 lines
777 B
Go
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")
|
|
}
|
|
}
|