Skip to content

Commit 8e1d6a2

Browse files
committed
Add fix
1 parent 3dab92d commit 8e1d6a2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/openai/http.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ module HTTP
77
include HTTPHeaders
88

99
def get(path:, parameters: nil)
10-
parse_jsonl(conn.get(uri(path: path), parameters) do |req|
11-
req.headers = headers
12-
end&.body)
10+
response = conn.get(uri(path: path), parameters) { |req| req.headers = headers }
11+
parse_jsonl(response.body)
12+
rescue JSON::ParserError
13+
response.body
1314
end
1415

1516
def post(path:)

0 commit comments

Comments
 (0)