(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func TestRelayErrorHandlerKeepsOpenAIErrorMessage(t *testing.T) { |
| 112 | message := strings.Repeat("d", common.LocalLogContentLimit+256) |
| 113 | body := `{"error":{"message":"` + message + `","type":"server_error","code":"server_error"}}` |
| 114 | resp := &http.Response{ |
| 115 | StatusCode: http.StatusInternalServerError, |
| 116 | Body: io.NopCloser(strings.NewReader(body)), |
| 117 | } |
| 118 | |
| 119 | newAPIError := RelayErrorHandler(context.Background(), resp, false) |
| 120 | |
| 121 | require.NotNil(t, newAPIError) |
| 122 | require.Equal(t, message, newAPIError.Error()) |
| 123 | } |
| 124 | |
| 125 | func TestRelayErrorHandlerKeepsInvalidJSONBodyInDebugLog(t *testing.T) { |
| 126 | withDebugEnabled(t, true) |
nothing calls this directly
no test coverage detected