Module: Rack::Test::Body::MessagePack

Included in:
MockResponse
Defined in:
lib/rack/test/body/msgpack.rb

Instance Method Summary collapse

Instance Method Details

#msgpack?(content_type = self.content_type) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rack/test/body/msgpack.rb', line 27

def msgpack?(content_type = self.content_type)
	content_type.start_with? "application/msgpack"
end

#parse_text(content_type, content, symbolize_keys: false) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/rack/test/body/msgpack.rb', line 31

def parse_text(content_type, content, symbolize_keys: false)
	if msgpack?(content_type)
		::MessagePack.load(content, symbolize_keys: symbolize_keys)
	else
		super
	end
end