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

Q: Set content-type when using render method? #22

Closed
lswest opened this issue Aug 13, 2016 · 2 comments
Closed

Q: Set content-type when using render method? #22

lswest opened this issue Aug 13, 2016 · 2 comments

Comments

@lswest
Copy link

lswest commented Aug 13, 2016

I'm in the process of testing out Cockpit CMS, which encourages the use of Lime in all their examples. So far, the only issue I've had is while trying to create a JSON file in PHP (from data in the Cockpit API) that I want to use for a small react app. The page is assigned the content-type text/html, instead of application/json, even though the view contains a header('Content-Type: application/json; charset=UTF-8').

Is there a way to change the content-type when using the $app-render() method, or is there a recommended solution to this?

@bstaint
Copy link

bstaint commented Aug 13, 2016

$app->get('/test', function(){
    $this->response->mime = 'json';
    return array('test'=>'test');
});

@lswest
Copy link
Author

lswest commented Aug 13, 2016

Thanks! That's solved it.

@lswest lswest closed this as completed Aug 13, 2016
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

2 participants