MCPcopy Create free account
hub / github.com/coder/coder / validateRequest

Function validateRequest

aibridge/internal/integrationtest/mockupstream.go:267–279  ·  view source on GitHub ↗

validateRequest dispatches to provider-specific validators based on URL path and fails the test immediately if the request body is invalid.

(t *testing.T, call int, path string, body []byte)

Source from the content-addressed store, hash-verified

265// validateRequest dispatches to provider-specific validators based on URL path
266// and fails the test immediately if the request body is invalid.
267func validateRequest(t *testing.T, call int, path string, body []byte) {
268 t.Helper()
269
270 msgAndArgs := []any{fmt.Sprintf("request #%d validation failed\n\nBody:\n%s", call+1, body)}
271 switch {
272 case strings.Contains(path, "/chat/completions"):
273 validateOpenAIChatCompletion(t, body, msgAndArgs...)
274 case strings.Contains(path, "/responses"):
275 validateOpenAIResponses(t, body, msgAndArgs...)
276 case strings.Contains(path, "/messages"):
277 validateAnthropicMessages(t, body, msgAndArgs...)
278 }
279}
280
281// validateOpenAIChatCompletion validates that an OpenAI chat completion request
282// has all required fields.

Callers 1

handleMethod · 0.85

Calls 5

validateOpenAIResponsesFunction · 0.85
HelperMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected