Open
Description
Currently, in many test cases, we return empty structs from the test server. For example:
server.RegisterHandler("/v1/engines/text-davinci-003", func(w http.ResponseWriter, r *http.Request) {
resBytes, _ := json.Marshal(Engine{}) // <------------- Here we return empty Engine struct
fmt.Fprintln(w, string(resBytes))
})
It is possible for such tests not to cover a case where client does not return a proper response, see for example this discussion: #485 (comment)
It would be good to make these structs non-empty, and the best solution would probably be to randomize them (keeping randomization logic in the internal/test
directory). So in the end we'll get something like:
server.RegisterHandler("/v1/engines/text-davinci-003", func(w http.ResponseWriter, r *http.Request) {
resBytes, _ := json.Marshal(Engine{ID: test.randomString(), Object: test.randomString()})
fmt.Fprintln(w, string(resBytes))
})