specify an API key in ChatAudioIO#1561
specify an API key in ChatAudioIO#1561stc1988 wants to merge 4 commits intoModdable-OpenSource:publicfrom
Conversation
| this.headers.delete("content-length"); | ||
| this.headers.delete("Content-Type"); |
There was a problem hiding this comment.
I'm curious about this change. I think I can see why you might need to clear content-length but isn't Content-Type always "application/json"?
There was a problem hiding this comment.
Indeed, the connection error was resolved simply by clearing the content-length. On the other hand, Content-Type is not considered required.
I don’t think it will cause an error in the future by being considered unnecessary, but I cleared the non-required items
There was a problem hiding this comment.
Thank you for the explanation. We should be consistent in how we communicate with a esrvice.
With this change, we set the Content-Type for some requests and not others. If you are confident the Content-Type is optional, then we should remove it from the headers altogether - then there's no need to delete it. Still, my experience is that it is safer to explicitly set the Content-Type, but maybe that's no longer the case.
There was a problem hiding this comment.
I reviewed the code again, and with this change there is no modification to the headers used for Web API requests.
The update only removes headers from the WebSocket connection request.
Currently, the API KEY can only be specified from the
config, but I have added an option to allow users to use their own specified values. There is no impact on the existing application code.Also, when I checked the behavior of this update, I found several issues, so I fixed them. Please see the commit for details.