MCPcopy Create free account
hub / github.com/gotify/server / TestDefaultErrorBadRequest

Function TestDefaultErrorBadRequest

error/handler_test.go:38–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestDefaultErrorBadRequest(t *testing.T) {
39 mode.Set(mode.TestDev)
40 rec := httptest.NewRecorder()
41 ctx, _ := gin.CreateTestContext(rec)
42 ctx.AbortWithError(400, errors.New("you need todo something"))
43
44 Handler()(ctx)
45
46 assertJSONResponse(t, rec, 400, `{"errorCode":400, "errorDescription":"you need todo something", "error":"Bad Request"}`)
47}
48
49type testValidate struct {
50 Username string `json:"username" binding:"required"`

Callers

nothing calls this directly

Calls 3

SetFunction · 0.92
HandlerFunction · 0.85
assertJSONResponseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…