litellm/tests/unit/decisions
paveln83 f517a821b3
fix(decisions): answer 400 naming extra_headers when it is not an object (#50581)
* fix(decisions): answer 400 naming extra_headers when it is not an object

A non-object extra_headers (string, int, list) or a non-string header value
crashed /v1/decisions and /v1/systemone with a 500. It is now validated with
the rest of the request, so it answers 400 naming extra_headers, and under
drop_params the malformed entries are dropped and the call goes through.

* fix(decisions): drop only the bad entry of extra_headers when its name is not a string

* fix(decisions): send an empty extra_headers as no headers, as before

* fix(decisions): keep main's assets drop and stop the extra_headers 400 from echoing the value

* fix(decisions): reject header text the HTTP clients cannot send, and share the check with the JEV classifier

A non-ASCII or CR/LF extra_headers name or value now answers 400, or is dropped under drop_params, instead of failing in httpx or aiohttp with a 500. The JEV classifier reads headers through the same helper, so a header the call drops no longer hides the deployment's input limits.

* fix(decisions): require token header names, trim header values, and keep traceparent forwarding off non-object extra_headers

* fix(decisions): keep printable header names sendable and cut a rejected header name at its first space or colon in the 400

* fix(decisions): require extra_headers names to be HTTP tokens

* fix(proxy): keep a supplied empty extra_headers object when forwarding traceparent

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-16 07:26:07 -05:00
..
__init__.py feat(decisions): add unified /v1/decisions endpoint for Jev-compatible providers (#44236) 2026-10-03 17:38:38 +00:00
test_call.py feat(gemini): support gemini-decision-1 on /v1/decisions and /v1/systemone (#51220) 2026-11-11 18:33:22 -08:00
test_main.py fix(decisions): answer 400 naming extra_headers when it is not an object (#50581) 2026-11-16 07:26:07 -05:00