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): ...@@ -232,7 +232,10 @@ class ResponseHeaderGenerator(ExtensionClass.Base):
if value: if value:
(setHeader if value_replace else appendHeader)(header_name, value) (setHeader if value_replace else appendHeader)(header_name, value)
elif value_replace: elif value_replace:
try:
removeHeader(header_name) removeHeader(header_name)
except KeyError:
pass
# else, no value and append: nothing to do. # else, no value and append: nothing to do.
return super( return super(
ResponseHeaderGenerator, 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