Skip to content

Commit

Permalink
InstanceMetadata: Fix compatibility with werkzeug 3.1.x (#8279)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblommers authored Nov 2, 2024
1 parent 2381df4 commit 72a11d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions moto/instance_metadata/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ def metadata_response( # type: ignore
raise NotImplementedError(
f"The {path} metadata path has not been implemented"
)
try:
from werkzeug.datastructures.headers import EnvironHeaders

if isinstance(headers, EnvironHeaders):
# We should be returning a generic dict here, not werkzeug-specific classes
headers = {key: value for key, value in headers}
except ImportError:
pass
return 200, headers, result

0 comments on commit 72a11d1

Please sign in to comment.