Skip to content

Commit f7d1de6

Browse files
authored
Fix do not raise error when using content_type instead of "content-type" and format is unrecognized
When writing to a RecognizeStream instance configure with a param 'content_type' instead of 'content-type' and the format can not be recognized from the first chunk (for example because we are directly streaming audion in L16 format) there is an exception generated. Both 'content_type' and 'content-type' are supposed to be supported and the method 'initialize()' homogenize those properties but at this point in the code it is not yet called.
1 parent 465a754 commit f7d1de6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/recognize-stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class RecognizeStream extends Duplex {
388388
return;
389389
}
390390
if (!this.initialized) {
391-
if (!this.options['content-type']) {
391+
if (!this.options['content-type'] && !this.options.content_type) {
392392
const ct = RecognizeStream.getContentType(chunk);
393393
if (ct) {
394394
this.options['content-type'] = ct;

0 commit comments

Comments
 (0)