mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-28 17:59:01 +01:00
Follow up to f3764b2545
: Update error code used for panics in unit tests
This commit is contained in:
parent
f9372dda75
commit
ce883279f7
@ -106,7 +106,7 @@ func withLogging(s *statsd.Client, out io.Writer) Middleware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// withPanicGuard is the last defence from a panic. it will log them and return a 500 error
|
// withPanicGuard is the last defence from a panic. it will log them and return a 503 error
|
||||||
// to the client and prevent the http server from breaking
|
// to the client and prevent the http server from breaking
|
||||||
func withPanicGuard() Middleware {
|
func withPanicGuard() Middleware {
|
||||||
return func(h http.Handler) http.Handler {
|
return func(h http.Handler) http.Handler {
|
||||||
|
@ -101,8 +101,8 @@ func TestPanicGuard(t *testing.T) {
|
|||||||
if panicked {
|
if panicked {
|
||||||
t.Fatalf("expected no panic")
|
t.Fatalf("expected no panic")
|
||||||
}
|
}
|
||||||
if w.Code != http.StatusInternalServerError {
|
if w.Code != http.StatusServiceUnavailable {
|
||||||
t.Errorf("expected status %d, got %d", http.StatusInternalServerError, w.Code)
|
t.Errorf("expected status %d, got %d", http.StatusServiceUnavailable, w.Code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ func TestMergeMiddlewares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "panics",
|
name: "panics",
|
||||||
handler: panicHandler,
|
handler: panicHandler,
|
||||||
expectedStatusCode: http.StatusInternalServerError,
|
expectedStatusCode: http.StatusServiceUnavailable,
|
||||||
expectedPieces: []string{
|
expectedPieces: []string{
|
||||||
`oh no`,
|
`oh no`,
|
||||||
`127.0.0.1 GET "/"`,
|
`127.0.0.1 GET "/"`,
|
||||||
|
Loading…
Reference in New Issue
Block a user