Skip to content

Conversation

@jwillis
Copy link
Contributor

@jwillis jwillis commented Sep 4, 2011

Objects now get serialized to xml if the content type is xml and the object responds to #to_xml.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you want encode_xml to always return XML, much like JSON to decrease the burden on the client? For example ... in the case where the object doesn't self-convert to XML?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'm not sure about adding a dependency to fall back to for xml serialization like multi_json does for json, or if I'm missing how to serialize with the current dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this, but it would be nice to get a follow-up. You can add another dependency if it makes sense.

dblock added a commit that referenced this pull request Sep 5, 2011
Call #to_xml if the content type is xml
@dblock dblock merged commit c406b1b into ruby-grape:master Sep 5, 2011
@dblock
Copy link
Member

dblock commented Sep 5, 2011

Btw, the README section has very little on txt/json/xml formats and default serialization. Maybe you can write some of it up? :)

@jwillis
Copy link
Contributor Author

jwillis commented Sep 6, 2011

I'll follow up on this once I find a good option for auto-serializing. I'll add to the docs too.

dblock added a commit that referenced this pull request Dec 5, 2011
Call #to_xml if the content type is xml
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

Successfully merging this pull request may close these issues.

2 participants