diff --git a/tests/integration/observability/test_grayswan_wire.py b/tests/integration/observability/test_grayswan_wire.py index 64ed6074f31..589c8d9d340 100644 --- a/tests/integration/observability/test_grayswan_wire.py +++ b/tests/integration/observability/test_grayswan_wire.py @@ -2,6 +2,7 @@ import json import uuid from collections.abc import Callable from pathlib import Path +from types import MappingProxyType from typing import Final import yaml @@ -143,16 +144,20 @@ def _chat_provider(message: dict[str, JsonValue]): return _serving_model_probe(respond) +_VOLATILE_HEADERS: Final = MappingProxyType( + { + "host": "", + "content-length": "", + "user-agent": "", + "accept-encoding": "", + } +) + + def _normalized_generic_body(body: dict[str, JsonValue]) -> dict[str, JsonValue]: headers: Final = body.get("request_headers") normalized_headers: Final = ( - { - **headers, - "host": "", - "content-length": "", - "user-agent": "", - "accept-encoding": "", - } + {**headers, **{name: placeholder for name, placeholder in _VOLATILE_HEADERS.items() if name in headers}} if isinstance(headers, dict) else headers )