Sha256: 424adf2d000c43166015124db0cbcd9572d97385bb9a8f7bf291d4dc337bab1a
Contents?: true
Size: 543 Bytes
Versions: 11
Compression:
Stored size: 543 Bytes
Contents
require 'yaml' module Goliath module Rack module Formatters # A YAML formatter. # # @example # use Goliath::Rack::Formatters::YAML class YAML include Goliath::Rack::AsyncMiddleware def post_process(env, status, headers, body) if yaml_response?(headers) body = [body.to_yaml] end [status, headers, body] end def yaml_response?(headers) headers['Content-Type'] =~ %r{^text/yaml} end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems