Sha256: 4d23084bcee14c8cfed9a6911888b26ef40708e4fd393ea6afe1233417bfee0a
Contents?: true
Size: 1018 Bytes
Versions: 3
Compression:
Stored size: 1018 Bytes
Contents
module Sparrow class ResponseHttpMessage < HttpMessage ## # @return [Integer] the HTTP Response Code status attr_accessor :status ## # @return the HTTP response body attr_accessor :body ## # @return the HTTP header after the middleware was called attr_accessor :headers ## # The wrapped Response instance # @return [Object] the response def response clazz = response_class @response ||= if clazz.name == 'ActionDispatch::Response' clazz.new(status, headers_hash, body) else clazz.new(body, status, headers_hash) end end def path super end def content_type response.content_type.presence || super end private def response_class if defined?(Rails) ActionDispatch::Response else ::Rack::Response end end def headers_hash @headers_hash ||= env.merge(headers) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cp-sparrow-0.0.16 | lib/sparrow/response_http_message.rb |
cp-sparrow-0.0.15 | lib/sparrow/response_http_message.rb |
cp-sparrow-0.0.14 | lib/sparrow/response_http_message.rb |