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

Show small example on how to render content-type, headers, etc #22

Closed
mulderp opened this issue Feb 1, 2013 · 2 comments
Closed

Show small example on how to render content-type, headers, etc #22

mulderp opened this issue Feb 1, 2013 · 2 comments

Comments

@mulderp
Copy link

mulderp commented Feb 1, 2013

Hello,

I was just playing with Cuba, and I would need to render JSON in the response for simulating API calls. However, I can't quickly see in the docs, how you responds with non-HTML.

Any pointers?

Thanks!

@djanowski
Copy link
Collaborator

You can do:

res.headers["Content-Type"] = "application/json; charset=utf-8"
res.write(foo.to_json)

@mulderp
Copy link
Author

mulderp commented Feb 1, 2013

nice! thanks for this snippet.

@mulderp mulderp closed this as completed Feb 1, 2013
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