Commit 13b0f6f5 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type.mixin.response_header_generator: Do not fail when removing a non-existent header.

Allows using an empty fallback value with "replace" set to trigger header
removal.
parent 8fd74907
Pipeline #18605 failed with stage
in 0 seconds
......@@ -232,7 +232,10 @@ class ResponseHeaderGenerator(ExtensionClass.Base):
if value:
(setHeader if value_replace else appendHeader)(header_name, value)
elif value_replace:
removeHeader(header_name)
try:
removeHeader(header_name)
except KeyError:
pass
# else, no value and append: nothing to do.
return super(
ResponseHeaderGenerator,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment