Skip to content

Commit

Permalink
Merge pull request #496 from soutaro/rack-response
Browse files Browse the repository at this point in the history
Fix rack `response` type
  • Loading branch information
soutaro authored Jan 9, 2024
2 parents 13ae8cd + 1c71abb commit ec140af
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions gems/rack/2.2/_test/string_body.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @type var app: Rack::_Application
app = _ = nil

middleware = -> (env) do
# @type var env: Rack::env
# @type block: Rack::response
[404, { "FOO" => "BAR" }, "Not found"]
end

middleware #: Rack::_Application
11 changes: 10 additions & 1 deletion gems/rack/2.2/rack.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ module Rack
def self.release: -> String

type env = Hash[String, untyped]
type response = [_ToI, _Each[[String, String]], _Each[String]]

type string_body = _ToStr

type enumerable_body = _Each[String]

interface _StreamingBody
def call: (untyped stream) -> void
end

type response = [_ToI, _Each[[String, String]], string_body | enumerable_body | _StreamingBody]

interface _Application
def call: (env) -> response
Expand Down

0 comments on commit ec140af

Please sign in to comment.