Module: Txgh::RespondWith
- Defined in:
- lib/txgh/app.rb
Instance Method Summary collapse
Instance Method Details
#respond_with(resp) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/txgh/app.rb', line 8 def respond_with(resp) env['txgh.response'] = resp if resp.streaming? response.headers.merge!(resp.headers) stream do |out| begin resp.write_to(out) rescue => e Txgh.events.publish_error(e) raise e end end else status resp.status json resp.body end end |