Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force response to application/json if request is not .json #10

Open
afrittella opened this issue Apr 9, 2011 · 0 comments
Open

Force response to application/json if request is not .json #10

afrittella opened this issue Apr 9, 2011 · 0 comments

Comments

@afrittella
Copy link

Before All thanks for your useful plugin. :)

I've found your comment in "headers" function. It's about on line 645...
// Don't know why, but RequestHandler isn't settings
// Content-Type right; so using header() for now instead

I was looking for a method to forse json content if the url is not controller.json and I think I've found a solution also for your problem.

If I move $this->headers(); from "initialize()" to "startup()", it works, because RequestHandler->startup() overwrite your changes with his recognized extension (line 244).

If it was correct, maybe it would be useful for updating your plugin.

I've added also some tricks in other functions.
If ($ext == 'html')
$ext = 'json';

sorry for my bad english! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant