Sha256: c8a1a816e38fd48aa24e1817e55ac09316b1c29a35964771602a40813a71e6ce
Contents?: true
Size: 696 Bytes
Versions: 10
Compression:
Stored size: 696 Bytes
Contents
# frozen_string_literal: true require 'rack' module Tipi module RackAdapter class << self def run(app) ->(req) { respond(req, app.(env(req))) } end def load(path) src = IO.read(path) instance_eval(src, path, 1) end def env(request) Qeweney.rack_env_from_request(request) end def respond(request, (status_code, headers, body)) headers[':status'] = status_code.to_s content = if body.respond_to?(:to_path) File.open(body.to_path, 'rb') { |f| f.read } else body.first end request.respond(content, headers) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems