Skip to content

Commit eff688b

Browse files
committed
Fix content type issue
1 parent 8e0c49e commit eff688b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

drift/instrumentation/aiohttp/instrumentation.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,21 @@ def headers(self):
818818
"""Return headers as a dict-like object."""
819819
return self._headers
820820

821+
def _get_header(self, name: str) -> str | None:
822+
"""Get header value with case-insensitive lookup.
823+
824+
HTTP headers are case-insensitive per RFC 7230.
825+
"""
826+
name_lower = name.lower()
827+
for key, value in self._headers.items():
828+
if key.lower() == name_lower:
829+
return value
830+
return None
831+
821832
@property
822833
def content_type(self) -> str:
823-
"""Return content type from headers."""
824-
return self._headers.get("content-type", "application/octet-stream")
834+
"""Return content type from headers (case-insensitive lookup)."""
835+
return self._get_header("content-type") or "application/octet-stream"
825836

826837
async def read(self) -> bytes:
827838
"""Read response body."""

0 commit comments

Comments
 (0)