Follow up to f3764b2545: Update error code used for panics in unit tests

This commit is contained in:
David Dworken 2023-09-30 22:22:31 -07:00
parent f9372dda75
commit ce883279f7
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -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
func withPanicGuard() Middleware {
return func(h http.Handler) http.Handler {

View File

@ -101,8 +101,8 @@ func TestPanicGuard(t *testing.T) {
if panicked {
t.Fatalf("expected no panic")
}
if w.Code != http.StatusInternalServerError {
t.Errorf("expected status %d, got %d", http.StatusInternalServerError, w.Code)
if w.Code != http.StatusServiceUnavailable {
t.Errorf("expected status %d, got %d", http.StatusServiceUnavailable, w.Code)
}
}
@ -162,7 +162,7 @@ func TestMergeMiddlewares(t *testing.T) {
{
name: "panics",
handler: panicHandler,
expectedStatusCode: http.StatusInternalServerError,
expectedStatusCode: http.StatusServiceUnavailable,
expectedPieces: []string{
`oh no`,
`127.0.0.1 GET "/"`,