Class: Goliath::Rack::Formatters::YAML
- Inherits:
-
Object
- Object
- Goliath::Rack::Formatters::YAML
- Includes:
- AsyncMiddleware
- Defined in:
- lib/goliath/rack/formatters/yaml.rb
Overview
A YAML formatter.
Instance Method Summary collapse
Methods included from AsyncMiddleware
#call, #final_response?, #hook_into_callback_chain, #initialize
Methods included from Validator
Instance Method Details
#post_process(env, status, headers, body) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/goliath/rack/formatters/yaml.rb', line 13 def post_process(env, status, headers, body) if yaml_response?(headers) body = [body.to_yaml] end [status, headers, body] end |
#yaml_response?(headers) ⇒ Boolean
20 21 22 |
# File 'lib/goliath/rack/formatters/yaml.rb', line 20 def yaml_response?(headers) headers['Content-Type'] =~ %r{^text/yaml} end |