Module: Utopia::Controller::Handlers::JSON

Defined in:
lib/utopia/controller/responder.rb

Constant Summary collapse

APPLICATION_JSON =
HTTP::Accept::ContentType.new("application", "json").freeze

Class Method Summary collapse

Class Method Details

.call(context, request, media_range, object, **options) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/utopia/controller/responder.rb', line 18

def self.call(context, request, media_range, object, **options)
	if version = media_range.parameters["version"]
		options[:version] = version.to_s
	end
	
	context.succeed! content: object.to_json(options), type: APPLICATION_JSON
end

.split(*arguments) ⇒ Object



14
15
16
# File 'lib/utopia/controller/responder.rb', line 14

def self.split(*arguments)
	APPLICATION_JSON.split(*arguments)
end