openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.57k stars 466 forks source link

headers to lowercase #306

Closed chengxs1994 closed 6 months ago

chengxs1994 commented 6 months ago

What:

Description:

Related:

gehrisandro commented 6 months ago

Hi @chengxs1994

Thank you for your PR!

Could you provide an example why this changes is necessary? As far as I understand the OpenAI docs, the headers should always be in lowercase.

huangdijia commented 6 months ago

According to the psr specification, the getHeaderLine method is case insensitive, but the conversion to array does not automatically convert to lowercase

https://www.php-fig.org/psr/psr-7/

While header names are not case-sensitive, getHeaders() will preserve the exact case in which headers were originally specified.

gehrisandro commented 6 months ago

Thanks for clarification 👍