Header::create doesn't create Headers


I was wondering, why Header::create() doesn’t actually create header(s), but rather creates a string.
Is this intended and why?
Thank You!

Yes, it creates Header string but doesn’t send a header. You can then use these strings in your code, e.g. when you make a remote request.

What do you want to do?

Ah, okay.
I want to setup some response headers in a route:before hook.
I solved it now by setting up a simple array i.e. in the config.php and then loop through it in the hook.
Thanks for the eplanation Sonja! :slight_smile:

$headers = [
  'Access-Control-Allow-Origin: https://some.domain',
  'Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization',

foreach($headers as $header) {