Skip to content

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

Description

@afrittella

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! :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions