Skip to content

Commit

Permalink
(fixed) Always use default header for accept-language, because it is …
Browse files Browse the repository at this point in the history
…unlikely to vary very much. Let headers remain on requests where the header VALUE differs.
  • Loading branch information
cyberw committed Mar 13, 2024
1 parent 0ec2638 commit 9ff6da5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions har2locust/default_plugins/default_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ def default_headers(entries: list[dict], _args):
default_headers = headers[:]
else:
for dh in default_headers[:]: # pylint: disable=unsubscriptable-object
if dh["name"] == "accept-language":
# accept-language is likely to be common among most requests so we never remove it from default headers
# (instead it will be overridden in the specific requests where it differs)
continue
for h in headers:
if h["name"] == "accept-language":
# accept-language is likely to be common among most requests so we never remove it from default headers
# (instead it will be overridden in the specific requests where it differs)
break
if dh["name"] == h["name"]:
if dh["value"] != h["value"]:
logging.debug(
f"removed default header {dh['name']} with value {dh['value']} from default headers because it has different value in {e['request']['url']}"
)
default_headers.remove(dh) # header has different value
break
break
else:
logging.debug(
Expand Down

0 comments on commit 9ff6da5

Please sign in to comment.