Skip to content

Commit

Permalink
clean more headers
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed May 2, 2024
1 parent ec1d977 commit 5cc19b4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions labapp/app/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def headers_cleaner(headers):
Remove headers that contain specific substrings.
Use this to make responses look nicer.
"""
unwanted_substrings = ['x-envoy', 'cloudfront', 'x-k8se']
unwanted_substrings = ['x-envoy', 'cloudfront', 'x-k8se', 'x-amz', 'z-amzn', 'via', 'x-arr-ssl']
filtered_headers = {
key: value for key, value in headers.items()
if not any(substring in key.lower() for substring in unwanted_substrings)
Expand All @@ -20,7 +20,6 @@ def cloudapp_fetch(session, url, timeout, prop, value):
response = session.get(url, timeout=timeout)
response.raise_for_status()
data = response.json()
print(data)
if data.get(prop) != value:
raise ValueError(f'Invalid {prop}: expected {value}, got {data.get(prop)}')
if data.get("request_headers"):
Expand Down Expand Up @@ -53,7 +52,6 @@ def cloudapp_res_headers(session, url, timeout, headers):
response = session.get(url, timeout=timeout)
response.raise_for_status()
data = response.headers
print(data)
for header in headers:
head_value = data.get(header)
if not head_value:
Expand Down

0 comments on commit 5cc19b4

Please sign in to comment.