header::create(), header::set(), header::link()
sebsel opened this issue · 0 comments
I really like this new method header::create()
! Looking forward to use it.
https://github.com/getkirby/toolkit/blob/develop/lib/header.php#L77
The name, however, collides a bit with header::created()
. I would like to suggest header::set()
as an alias / rename.
Also, from reading the code, the function never actually sets the header with header()
, it only returns it as a string. You can't, however, use it like header(header::create(['a'=>'b', 'c'=>'d']));
: PHP will complain ('Warning: Header may not contain more than a single header, new line detected').
I was wondering how it was mend to be used.
And finally, I would like to easily send a HTTP Link header, something like this would be nice:
header::link('/webmention', 'webmention');
// Link: </webmention>; rel="webmention"
header::link([
'/micropub' => 'micropub',
'https://indieauth.com/auth' => 'authorization_endpoint',
'https://tokens.indieauth.com/token' => 'token_endpoint',
]);
// Link: </micropub>; rel="micropub"
// Link: <https://indieauth.com/auth>; rel="authorization_endpoint"
// Link: <https://tokens.indieauth.com/token>; rel="token_endpoint"
I can try something and send a PR if you're interested :)