CodeIgniter Forums
Prevent Content-Type at Http-Status-Code 204 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Prevent Content-Type at Http-Status-Code 204 (/showthread.php?tid=78167)



Prevent Content-Type at Http-Status-Code 204 - David Schmucker - 12-08-2020

Hi there,

it is possible to prevent/remove the default Content-Type Header when using the HTTP\Response class?

The Http-Status-Code 204 (no content) should send without a Content-Type Header.

greetings
david


RE: Prevent Content-Type at Http-Status-Code 204 - sammyskills - 12-08-2020

See this from the docs.


RE: Prevent Content-Type at Http-Status-Code 204 - David Schmucker - 12-08-2020

Yeah, but after removing the Content-Type Header with removeHeader('Content-Type') the default Content-Type Header ('text/html') is set. Unfortunaly it is hardcoded within the HTTP/Response constructor.