MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestChat401

Function TestChat401

internal/llm/llm_test.go:446–455  ·  view source on GitHub ↗

TestChat401: maps to typed ErrUnauthorized.

(t *testing.T)

Source from the content-addressed store, hash-verified

444
445// TestChat401: maps to typed ErrUnauthorized.
446func TestChat401(t *testing.T) {
447 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
448 w.WriteHeader(http.StatusUnauthorized)
449 }))
450 defer srv.Close()
451 evs := collect(New(srv.URL, "m", "").Chat(context.Background(), nil, nil))
452 if len(evs) != 1 || !errors.Is(evs[0].Err, cloud.ErrUnauthorized) {
453 t.Fatalf("want ErrUnauthorized, got %+v", evs)
454 }
455}
456
457// TestChat401DrainsBodyForConnReuse: a 401 carrying a body must have that body
458// drained before close, or Go's transport discards the TCP connection instead

Callers

nothing calls this directly

Calls 3

collectFunction · 0.85
ChatMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected