File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,21 @@ public function register_hooks(): void {
3131 * @return array<int, string> Modified headers.
3232 */
3333 public function allowed_cors_headers ( $ headers ): array {
34- // Skip if the headers are already present.
35- if ( in_array ( 'X-OneDesign-Token ' , $ headers , true ) ) {
36- return $ headers ;
34+
35+ $ headers_to_add = [
36+ 'X-OneDesign-Token ' ,
37+ 'X-OneDesign-Source ' ,
38+ ];
39+
40+ // Only add headers that aren't already present.
41+ foreach ( $ headers_to_add as $ header ) {
42+ if ( in_array ( $ header , $ headers , true ) ) {
43+ continue ;
44+ }
45+
46+ $ headers [] = $ header ;
3747 }
3848
39- return array_merge (
40- $ headers ,
41- [
42- 'X-OneDesign-Token ' ,
43- 'X-OneDesign-Source ' ,
44- ]
45- );
49+ return $ headers ;
4650 }
4751}
You can’t perform that action at this time.
0 commit comments