Skip to content

Commit ed98bb8

Browse files
committed
Allow response to replace headers via config
1 parent 43aee7a commit ed98bb8

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

guide/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ Response Config Options
10061006
'csp' => [],
10071007
'csp_report_only' => [],
10081008
'json_flags' => null,
1009+
'replace_headers' => false,
10091010
'request_instance' => 'default',
10101011
],
10111012
],
@@ -1065,6 +1066,11 @@ json_flags
10651066

10661067
Flags for ``json_encode``. The default is set to none.
10671068

1069+
replace_headers
1070+
"""""""""""""""
1071+
1072+
Set ``true`` to force header replacement. Default is ``false`` to not replace.
1073+
10681074
request_instance
10691075
""""""""""""""""
10701076

src/App.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,9 @@ protected static function setResponse(string $instance) : Response
12561256
if (isset($config['json_flags'])) {
12571257
$service->setJsonFlags($config['json_flags']);
12581258
}
1259+
if (isset($config['replace_headers'])) {
1260+
$service->setReplaceHeaders($config['replace_headers']);
1261+
}
12591262
return static::setService('response', $service, $instance);
12601263
}
12611264

tests/configs/response.config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
],
4040
],
4141
'json_flags' => \JSON_THROW_ON_ERROR,
42+
'replace_headers' => false,
4243
'request_instance' => 'default',
4344
],
4445
];

0 commit comments

Comments
 (0)