Skip to content

Commit 4383da5

Browse files
committed
refactor: simplify header normalization in from_http function
Signed-off-by: Tudor Plugaru <[email protected]>
1 parent f7b0518 commit 4383da5

File tree

1 file changed

+2
-5
lines changed
  • src/cloudevents/core/bindings

1 file changed

+2
-5
lines changed

src/cloudevents/core/bindings/http.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,7 @@ def from_http(
288288
:param event_factory: Factory function to create CloudEvent instances
289289
:return: CloudEvent instance
290290
"""
291-
normalized_headers = _normalize_headers(message.headers)
292-
293-
for header_name in normalized_headers.keys():
294-
if header_name.startswith(CE_PREFIX):
295-
return from_binary(message, event_format, event_factory)
291+
if any(key.lower().startswith(CE_PREFIX) for key in message.headers.keys()):
292+
return from_binary(message, event_format, event_factory)
296293

297294
return from_structured(message, event_format, event_factory)

0 commit comments

Comments
 (0)