File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ def writable_enum(&blk)
470470 # @type [Regexp]
471471 JSON_CONTENT = %r{^application/(?:vnd(?:\. [^.]+)*\+ )?json(?!l)}
472472 # @type [Regexp]
473- JSONL_CONTENT = %r{^application/(?: x-)?jsonl}
473+ JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?: x-)?jsonl) }
474474
475475 class << self
476476 # @api private
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ module OpenAI
187187 end
188188
189189 JSON_CONTENT = T . let ( %r{^application/(?:vnd(?:\. [^.]+)*\+ )?json(?!l)} , Regexp )
190- JSONL_CONTENT = T . let ( %r{^application/(?: x-)?jsonl} , Regexp )
190+ JSONL_CONTENT = T . let ( %r{^application/(:?x-(?:n|l)djson)|(:?(?: x-)?jsonl) } , Regexp )
191191
192192 class << self
193193 # @api private
Original file line number Diff line number Diff line change @@ -172,6 +172,22 @@ def test_json_content
172172 end
173173 end
174174 end
175+
176+ def test_jsonl_content
177+ cases = {
178+ "application/x-ndjson" => true ,
179+ "application/x-ldjson" => true ,
180+ "application/jsonl" => true ,
181+ "application/x-jsonl" => true ,
182+ "application/json" => false ,
183+ "application/vnd.api+json" => false
184+ }
185+ cases . each do |header , verdict |
186+ assert_pattern do
187+ OpenAI ::Internal ::Util ::JSONL_CONTENT . match? ( header ) => ^verdict
188+ end
189+ end
190+ end
175191end
176192
177193class OpenAI ::Test ::UtilFormDataEncodingTest < Minitest ::Test
You can’t perform that action at this time.
0 commit comments