Class: Jets::Shim::Response::Base
- Inherits:
-
Object
- Object
- Jets::Shim::Response::Base
- Includes:
- Util::Logging, Util::Truthy
- Defined in:
- lib/jets/shim/response/base.rb
Instance Method Summary collapse
-
#initialize(triplet) ⇒ Base
constructor
A new instance of Base.
- #translate ⇒ Object
Methods included from Util::Truthy
Methods included from Util::Logging
Constructor Details
#initialize(triplet) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/jets/shim/response/base.rb', line 13 def initialize(triplet) @triplet = triplet end |
Instance Method Details
#translate ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jets/shim/response/base.rb', line 20 def translate status, headers, rack_body = @triplet headers.merge!(prewarm_headers) = (headers) stringify_values!(headers) body = translate_body(rack_body) base64 = base64_encode?(headers) if base64 body = Base64.strict_encode64(body) end resp = { statusCode: status, headers: headers, # response headers body: body, cookies: , isBase64Encoded: base64 }.delete_if { |k, v| v.nil? } show_debug_shim_resp(resp) resp end |