diff --git a/lib/barista/server.rb b/lib/barista/server.rb index 3bc18df..e207038 100644 --- a/lib/barista/server.rb +++ b/lib/barista/server.rb @@ -79,7 +79,7 @@ def forbidden body = "Forbidden\n" [403, { 'Content-Type' => 'text/plain', - 'Content-Length' => Rack::Utils.bytesize(body).to_s, + 'Content-Length' => body.bytesize.to_s, 'X-Cascade' => 'pass' }, [body]] end @@ -90,7 +90,7 @@ def not_found body = "Not Found\n" [404, { 'Content-Type' => 'text/plain', - 'Content-Length' => Rack::Utils.bytesize(body).to_s, + 'Content-Length' => body.bytesize.to_s, 'X-Cascade' => 'pass' }, [body]] end @@ -99,7 +99,7 @@ def not_found def response_for_text(content, content_type = 'text/javascript', modified_at = nil) headers = { 'Content-Type' => content_type, - 'Content-Length' => Rack::Utils.bytesize(content).to_s, + 'Content-Length' => content.bytesize.to_s, 'Cache-Control' => "public, max-age=#{CACHE_FOR_SECONDS}" } headers.merge!('Last-Modified' => modified_at.httpdate) unless modified_at.nil?