mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-27 09:18:55 +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
|
||||
func withPanicGuard() Middleware {
|
||||
return func(h http.Handler) http.Handler {
|
||||
|
@ -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 "/"`,
|
||||
|
Loading…
Reference in New Issue
Block a user