Files
magpie/internal/gateway/codearts_param_test.go
T
yetone 4e0026661c gateway: CodeArts's "request param is invalid" is the request's, nobody rests (Abandon332 on X, #6342)
Huawei's gateway answers a parameter it can't take (the codearts plugin sent
`stop` as an array; plugin 0.3.15 sends a string) with InferHub.001001005.400
inside a 200. magpie read it as a plain 400 and rested the account, 182
times in the report. The code joins shapeWords, so a member behind it is
asked and the one that refused doesn't rest, as for any request shape a
vendor can't read.

Run (mica): TestCodeArtsInvalidParamIsTheRequests, shapeRefused, custom-tool
tests; go vet on darwin, windows, linux nogui; gofmt clean. The new test was
red before the regex change. Not tried: a real CodeArts account; the whole
suite (started after the tag). The last member in a group still rests as
before, since shapeRefused only applies when another is left.
2026-11-12 22:53:32 +08:00

17 lines
684 B
Go

package gateway
import "testing"
// Huawei CodeArts answers a request parameter it can't take (a `stop` array,
// #6342) with a 400 that names a code only: the request's content, not the
// account, so the next member is asked and nobody rests.
func TestCodeArtsInvalidParamIsTheRequests(t *testing.T) {
body := `{"error":{"message":"华为云 CodeArts: The request param is invalid, Please check it (InferHub.001001005.400)"}}`
if !shapeRefused(400, []byte(body)) {
t.Errorf("no next member over: %s", body)
}
if shapeRefused(400, []byte(`{"error":{"message":"InferHub.4004.200 benefit not found"}}`)) {
t.Error("another CodeArts code counted as the request's shape")
}
}