Skip to content

Commit

Permalink
fix: test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuangls committed Oct 9, 2023
1 parent f6e93e7 commit c99a010
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ func TestChatCompletionsWithRateLimitHeaders(t *testing.T) {
if string(bs1) != string(bs2) {
t.Errorf("expected rate limit header %s to be %s", bs2, bs1)
}
headers.ResetRequests = "xxx"
headers.ResetTokens = "xxx"
_, err = headers.ParseResetRequestsTime()
checks.HasError(t, err, "ParseResetRequestsTime not error")
_, err = headers.ParseResetTokensTime()
checks.HasError(t, err, "ParseResetTokensTime not error")
}

// TestChatCompletionsFunctions tests including a function call.
Expand Down
5 changes: 1 addition & 4 deletions stream_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ func (stream *streamReader[T]) Close() {
}

func (stream *streamReader[T]) Header() http.Header {
if stream.response != nil {
return stream.response.Header
}
return map[string][]string{}
return stream.response.Header
}

func (stream *streamReader[T]) GetRateLimitHeaders() RateLimitHeaders {
Expand Down

0 comments on commit c99a010

Please sign in to comment.