MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestDefaultCodeForStatus

Function TestDefaultCodeForStatus

internal/httpapi/errors_test.go:37–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestDefaultCodeForStatus(t *testing.T) {
38 cases := map[int]string{
39 http.StatusBadRequest: "bad_request",
40 http.StatusUnauthorized: "unauthorized",
41 http.StatusForbidden: "forbidden",
42 http.StatusNotFound: "not_found",
43 http.StatusConflict: "conflict",
44 http.StatusTooManyRequests: "rate_limited",
45 http.StatusInternalServerError: "internal_error",
46 http.StatusBadGateway: "internal_error",
47 418: "error",
48 }
49 for status, want := range cases {
50 if got := defaultCodeForStatus(status); got != want {
51 t.Errorf("status %d: got %q want %q", status, got, want)
52 }
53 }
54}
55
56func TestHumaErrorConstructorEnvelope(t *testing.T) {
57 // The constructor installed as huma.NewError must yield our envelope so

Callers

nothing calls this directly

Calls 1

defaultCodeForStatusFunction · 0.85

Tested by

no test coverage detected