lib/hyperion/formats.rb in hyperion_http-0.1.5 vs lib/hyperion/formats.rb in hyperion_http-0.1.6
- old
+ new
@@ -1,9 +1,10 @@
require 'oj'
require 'stringio'
require 'hyperion/aux/logger'
require 'abstractivator/enum'
+require 'hyperion/types/multipart'
class Hyperion
module Formats
# Serializes and deserializes the supported formats.
# This is done as gracefully as possible.
@@ -11,9 +12,10 @@
include Hyperion::Logger
define_enum :Known, :json, :protobuf
def write(obj, format)
+ return obj.body if obj.is_a?(Multipart)
return obj if obj.is_a?(String) || obj.nil? || format.nil?
case Formats.get_from(format)
when :json; write_json(obj)
when :protobuf; obj