0
このテストを検討してくださいがあります。 200
を返すとされるアサーションは、実際には404
を返します。 同じ要求に対して2つの異なる結果を返すためにラックはどのように動作しますか?私はそれを貼り付けることができますが、Githubにプロジェクトをチェックアウトすることができため同じ要求は、二つの異なる応答
module Blogrite
class Server
attr_accessor :status, :mimetype, :body, :provider
def initialize *args, &block
@status, @mimetype = 200, "text/html"
provider = args[0][:with].nil? ? :filesystem : args[0][:with]
@provider = Blogrite.const_get(provider.capitalize).new
# p "Server is running with #{@provider.class}."
end
def call env
begin
article = go env['PATH_INFO'].delete("/")
rescue Blogrite::Article::NoBodyError
@status = 404
end
@status = 404 if !article
@status = 403 if env["REQUEST_METHOD"] == 'POST'
@mimetype = "text/css" if env["PATH_INFO"].include?("css")
@body = if article then article.render
elsif env.respond_to?(:to_yaml) then "<pre>#{env.to_yaml}</pre>"
else "oops"
end
[@status,{ "Content-Type" => @mimetype},[@body]]
end
def go path
f = @provider.fetch path
Article.parse f unless f.nil?
end
end
end
ワークフロー全体が大きすぎる:
このは、プロジェクト内のサーバ・クラスのコードです。私はあなたの助けに感謝します、ありがとう。