mirror of
https://github.com/airlabspl/uptimemonitor.git
synced 2025-08-14 20:29:16 +02:00
28 lines
551 B
Go
28 lines
551 B
Go
package test
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func TestMiddleware(t *testing.T) {
|
|
t.Run("panic recoverer", func(t *testing.T) {
|
|
tc := NewTestCase(t)
|
|
defer tc.Close()
|
|
|
|
tc.Get("/test/panic").AssertStatusCode(http.StatusInternalServerError)
|
|
})
|
|
|
|
t.Run("cache test", func(t *testing.T) {
|
|
tc := NewTestCase(t)
|
|
defer tc.Close()
|
|
|
|
tc.LogIn().
|
|
Get("/").
|
|
AssertStatusCode(http.StatusOK).
|
|
AssertHeader("Cache-Control", "no-cache, no-store, must-revalidate").
|
|
AssertHeader("Pragma", "no-cache").
|
|
AssertHeader("Expires", "0")
|
|
})
|
|
}
|