Server: Write internal server error on missing write (#57813)
This commit is contained in:
@@ -2,8 +2,11 @@ package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
@@ -94,3 +97,17 @@ func TestContext_RemoteAddr(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestContext_noHandler(t *testing.T) {
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
method := http.MethodGet
|
||||
c := &Context{
|
||||
Req: httptest.NewRequest(method, "/", nil),
|
||||
Resp: NewResponseWriter(method, recorder),
|
||||
}
|
||||
|
||||
c.run()
|
||||
|
||||
assert.Equal(t, http.StatusInternalServerError, recorder.Code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user