What kind of change does this PR introduce? (pls check at least one)
[ ] Bugfix
[x] Feature
[ ] Code style update
[ ] Refactor
[ ] Build-related changes
[ ] Other, please describe below
Description
As described in #21 there was no way to create custom Content-Type responses. (I needed it for a js response)
I added
/**
* Output any text
*
* @param string $data The data to output
* @param int $code The response status code
*/
public function echo(string $data, int $code = 200)
{
$this->status = $code;
$this->headers['Content-Type'] ??= 'text/plain';
$this->content = $data;
$this->send();
}
to add custom content type functionality with a fallback to text/plain
Then I added a "js()" function with Content-Type of text/javascript to fit my exact need (might not be super common).
Does this PR introduce a breaking change? (check one)
What kind of change does this PR introduce? (pls check at least one)
Description
As described in #21 there was no way to create custom
Content-Type
responses. (I needed it for a js response)I added
to add custom content type functionality with a fallback to
text/plain
Then I added a "js()" function with
Content-Type
oftext/javascript
to fit my exact need (might not be super common).Does this PR introduce a breaking change? (check one)
Related Issue
21