diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-05-04 13:23:38 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-05-04 13:33:19 -0700 |
commit | 57909fb76dd0bcf95bed94ec41933ec85afda885 (patch) | |
tree | 0f91a27229fd513d32b4387416221b5d1601184f /t/app_deferred.ru | |
parent | dcf280239978e00435760470b5ddf67254312c75 (diff) | |
download | rainbows-57909fb76dd0bcf95bed94ec41933ec85afda885.tar.gz |
Merb (and possibly other) frameworks that support conditionally deferred app dispatch can now use it just like Ebb and Thin. http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin
Diffstat (limited to 't/app_deferred.ru')
-rw-r--r-- | t/app_deferred.ru | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/app_deferred.ru b/t/app_deferred.ru new file mode 100644 index 0000000..179ac95 --- /dev/null +++ b/t/app_deferred.ru @@ -0,0 +1,22 @@ +#\-E none +# can't use non-compatible middleware that doesn't pass "deferered?" calls +# +# used for testing deferred actions for Merb and possibly other frameworks +# ref: http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin + +class DeferredApp < Struct.new(:app) + def deferred?(env) + env["PATH_INFO"] == "/deferred" + end + + def call(env) + body = "#{Thread.current.inspect}\n" + headers = { + "Content-Type" => "text/plain", + "Content-Length" => body.size.to_s, + } + [ 200, headers, [ body ] ] + end +end + +run DeferredApp.new |