roots / acorn

Laravel components for WordPress plugins and themes
https://roots.io/acorn/
MIT License
824 stars 94 forks source link

🩹 Trim one optional leading space from headers #405

Closed RafaelKr closed 1 month ago

RafaelKr commented 1 month ago

In my last PR #402 @QWp6t removed the ltrim. This leads to one added leading space to every header value. See https://github.com/roots/acorn/issues/404#issuecomment-2391024852

This PR can handle the case X-Header:Value which #402 already fixed without adding or removing leading whitespace in other cases.

Examples:

'X-Header:Value' => ['X-Header', 'Value']
'X-Header: Value' => ['X-Header', 'Value']
'X-Header:  Value' => ['X-Header', ' Value']
'X-Header:   Value' => ['X-Header', '  Value']
QWp6t commented 1 month ago

I appreciate your persistence and thanks for clarifying the issue. 🙏