MCPcopy
hub / github.com/danielgtaylor/huma / TestNegotiateError

Function TestNegotiateError

error_test.go:107–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func TestNegotiateError(t *testing.T) {
108 _, api := humatest.New(t, huma.Config{OpenAPI: &huma.OpenAPI{Info: &huma.Info{Title: "Test API", Version: "1.0.0"}}})
109
110 req, _ := http.NewRequest("GET", "/", nil)
111 resp := httptest.NewRecorder()
112 ctx := humatest.NewContext(&huma.Operation{}, req, resp)
113 require.Error(t, huma.WriteErr(api, ctx, 400, "bad request"))
114}
115
116func TestTransformError(t *testing.T) {
117 config := huma.DefaultConfig("Test API", "1.0.0")

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
NewContextFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…