File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ package extproc
77
88import (
99 "context"
10- "encoding/json"
1110 "errors"
1211 "io"
1312 "log/slog"
@@ -38,16 +37,16 @@ func TestResponsesProcessorFactory(t *testing.T) {
3837
3938func Test_parseOpenAIResponseBody (t * testing.T ) {
4039 t .Run ("ok" , func (t * testing.T ) {
41- req := openai. ResponseRequest { Model : "m1" }
42- b , _ := json . Marshal ( req )
40+ // Use raw JSON to avoid issues with union-type marshalling in test structs.
41+ b := [] byte ( `{"model":"m1"}` )
4342 model , rr , err := parseOpenAIResponseBody (& extprocv3.HttpBody {Body : b })
4443 require .NoError (t , err )
4544 require .Equal (t , "m1" , model )
46- require .Equal (t , & req , rr )
45+ // Ensure parsed request has the expected model value
46+ require .Equal (t , "m1" , rr .Model )
4747 })
4848 t .Run ("error missing model" , func (t * testing.T ) {
49- req := openai.ResponseRequest {}
50- b , _ := json .Marshal (req )
49+ b := []byte (`{}` )
5150 _ , _ , err := parseOpenAIResponseBody (& extprocv3.HttpBody {Body : b })
5251 require .Error (t , err )
5352 })
You can’t perform that action at this time.
0 commit comments