From 98888713e41adc689e9937fc71adbe358b5985ec Mon Sep 17 00:00:00 2001 From: yucheng Date: Wed, 30 Sep 2026 18:43:14 +0000 Subject: [PATCH] test(grayswan): keep volatile header placeholders only when the header is present Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../observability/test_grayswan_wire.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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 )