Custom MIME Type

7 views
Skip to first unread message

Oliver

unread,
Aug 23, 2011, 3:24:15 PM8/23/11
to restfulie
Hi guys

I am trying to use a custom MIME type, something like "application/
vnd.myapp+json", could you please tell me what do I need to do to
support it?

I've been searching the restfulie wiki and this forum, but I haven't
found a solution.

Do I need to add a helper to Hypertemplate?

Do I need to call acts_as_restfulie in my model and then register the
media type?

I'd appreciate your help.

Thanks.

Anthony Roux

unread,
Aug 25, 2011, 3:35:21 AM8/25/11
to rest...@googlegroups.com
Hello,

You can set the content type directly in the header with the method "as"

    #Set Content-Type and Accept headers
    def as(content_type)
      headers['Content-Type'] = content_type
      accepts(content_type)
    end


Example on this page:

Anthony.

2011/8/23 Oliver <olyv...@gmail.com>
Reply all
Reply to author
Forward
0 new messages