Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shallow copy headers to avoid mutating the original (#30)
With Codestral and maybe other backends the same headers are passed to Get for every request. Without this change for each request an additional Content-Type header is added. Codestral fails when multiple Content-Type headers are present. For example when using Codestral I generated the folloing curl args ``` { "https://codestral.mistral.ai/v1/fim/completions", "-d", "@/tmp/lua_vZiQ6f", "-H", "Authorization: Bearer ************************", "-H", "Content-Type: application/json", "-H", "Content-Type: application/json", "-H", "Content-Type: application/json", "-H", "Content-Type: application/json" } ``` And I get the response: ``` {\n code = vim.NIL,\n message = "Input should be a valid dictionary or object to extract fields from",\n object = "error",\n param = vim.NIL,\n type = "invalid_request_error"\n} ``` This commit makes a shallow copy of the headers before adding additional headers
- Loading branch information