Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Compatability issue with hanami-controller 2.0.0.alpha1 #307
One thing that I came across is that hanami controller just doesn't work as it should by rack spec (perhaps that's expected)
source "https://rubygems.org" gem 'hanami-router', '~> 2.0.0.alpha1' gem 'hanami-controller', '~> 2.0.0.alpha1'
# frozen_string_literal: true require 'hanami/router' require 'hanami/controller' class TestController < Hanami::Action def handle(_req, res) res.body = "ok" res.status = 200 end end app = Hanami::Router.new(configuration: Hanami::Controller::Configuration.new) do get '/', to: "test_controller" end run app
The problem is that hanami controller doesn't return rack compatible return value (it returns an instance of
So the question is: Am I doing something very wrong? If so how to fix it correctly in this example.
class BaseAction < Hanami::Action def call(env) super.to_a end end class TestController < BaseAction def handle(_req, res) res.body = "ok" res.status = 200 end end