Search code examples
phpmamphttpresponseslim

Include_once in Slim Framework, ruins the header


I faced an issue, for several days now, where the response header on my very simple API, built with Slim Framework, returned HTML/TEXT instead of APPLICATION/JSON – no matter what I did.

I found out, that the problem could be solved if I removed my only include_once in the file; a file that contains some configuration variables, but writing everything in one file is not feasible.

What am I doing wrong?


Solution

  • The answer was to remove BOM from the file. Include a file with BOM apparently affects the response header somehow.