package suite import ( "errors" "net/http" "strings" "testing" ) func TestSiblingClientRefusesPlaintextBeforeSendingCredentials(t *testing.T) { d := &recordingDialer{} c := NewSiblingClient("acme", d.dial) req, err := http.NewRequest("POST", "http://acme.docs.oficina.works/suite/s2", strings.NewReader(`{"item_id":"fixture"}`)) if err != nil { t.Fatal(err) } req.Header.Set("Authorization", "Bearer synthetic-fixture") _, err = c.Do(req) if !errors.Is(err, ErrContractBreach) { t.Errorf("plain HTTP returned %v; want contract refusal", err) } if len(d.dialed) != 0 { t.Errorf("plaintext credential request attempted network connection: %v", d.dialed) } }