X7ROOT File Manager
Current Path:
/opt/alt/ruby22/lib64/ruby/gems/2.2.0/gems/rack-1.6.4/test
opt
/
alt
/
ruby22
/
lib64
/
ruby
/
gems
/
2.2.0
/
gems
/
rack-1.6.4
/
test
/
📁
..
📁
builder
📁
cgi
📄
gemloader.rb
(298 B)
📁
multipart
📁
rackup
📁
registering_handler
📄
spec_auth_basic.rb
(2.26 KB)
📄
spec_auth_digest.rb
(8.08 KB)
📄
spec_body_proxy.rb
(2.2 KB)
📄
spec_builder.rb
(6.2 KB)
📄
spec_cascade.rb
(2.11 KB)
📄
spec_cgi.rb
(2.92 KB)
📄
spec_chunked.rb
(3.87 KB)
📄
spec_commonlogger.rb
(2.37 KB)
📄
spec_conditionalget.rb
(3.28 KB)
📄
spec_config.rb
(544 B)
📄
spec_content_length.rb
(2.8 KB)
📄
spec_content_type.rb
(1.47 KB)
📄
spec_deflater.rb
(10.04 KB)
📄
spec_directory.rb
(2.19 KB)
📄
spec_etag.rb
(3.84 KB)
📄
spec_fastcgi.rb
(3.08 KB)
📄
spec_file.rb
(6.32 KB)
📄
spec_handler.rb
(1.87 KB)
📄
spec_head.rb
(1.36 KB)
📄
spec_lint.rb
(19.23 KB)
📄
spec_lobster.rb
(1.23 KB)
📄
spec_lock.rb
(4.33 KB)
📄
spec_logger.rb
(622 B)
📄
spec_methodoverride.rb
(2.38 KB)
📄
spec_mime.rb
(1.81 KB)
📄
spec_mock.rb
(9.34 KB)
📄
spec_mongrel.rb
(5.73 KB)
📄
spec_multipart.rb
(23.62 KB)
📄
spec_nulllogger.rb
(514 B)
📄
spec_recursive.rb
(1.83 KB)
📄
spec_request.rb
(42.52 KB)
📄
spec_response.rb
(10.08 KB)
📄
spec_rewindable_input.rb
(2.78 KB)
📄
spec_runtime.rb
(1.53 KB)
📄
spec_sendfile.rb
(4.12 KB)
📄
spec_server.rb
(5.57 KB)
📄
spec_session_abstract_id.rb
(1.29 KB)
📄
spec_session_cookie.rb
(12.94 KB)
📄
spec_session_memcache.rb
(11.12 KB)
📄
spec_session_pool.rb
(6.53 KB)
📄
spec_showexceptions.rb
(2.01 KB)
📄
spec_showstatus.rb
(2.74 KB)
📄
spec_static.rb
(4.6 KB)
📄
spec_tempfile_reaper.rb
(1.57 KB)
📄
spec_thin.rb
(2.55 KB)
📄
spec_urlmap.rb
(8.82 KB)
📄
spec_utils.rb
(24.89 KB)
📄
spec_version.rb
(504 B)
📄
spec_webrick.rb
(5.5 KB)
📁
static
📄
testrequest.rb
(1.96 KB)
📁
unregistered_handler
Editing: spec_etag.rb
require 'rack/etag' require 'rack/lint' require 'rack/mock' require 'time' describe Rack::ETag do def etag(app, *args) Rack::Lint.new Rack::ETag.new(app, *args) end def request Rack::MockRequest.env_for end def sendfile_body res = ['Hello World'] def res.to_path ; "/tmp/hello.txt" ; end res end should "set ETag if none is set if status is 200" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['ETag'].should.equal "W/\"65a8e27d8879283831b664bd8b7f0ad4\"" end should "set ETag if none is set if status is 201" do app = lambda { |env| [201, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['ETag'].should.equal "W/\"65a8e27d8879283831b664bd8b7f0ad4\"" end should "set Cache-Control to 'max-age=0, private, must-revalidate' (default) if none is set" do app = lambda { |env| [201, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['Cache-Control'].should.equal 'max-age=0, private, must-revalidate' end should "set Cache-Control to chosen one if none is set" do app = lambda { |env| [201, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app, nil, 'public').call(request) response[1]['Cache-Control'].should.equal 'public' end should "set a given Cache-Control even if digest could not be calculated" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, []] } response = etag(app, 'no-cache').call(request) response[1]['Cache-Control'].should.equal 'no-cache' end should "not set Cache-Control if it is already set" do app = lambda { |env| [201, {'Content-Type' => 'text/plain', 'Cache-Control' => 'public'}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['Cache-Control'].should.equal 'public' end should "not set Cache-Control if directive isn't present" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app, nil, nil).call(request) response[1]['Cache-Control'].should.equal nil end should "not change ETag if it is already set" do app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'ETag' => '"abc"'}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['ETag'].should.equal "\"abc\"" end should "not set ETag if body is empty" do app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'Last-Modified' => Time.now.httpdate}, []] } response = etag(app).call(request) response[1]['ETag'].should.be.nil end should "not set ETag if Last-Modified is set" do app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'Last-Modified' => Time.now.httpdate}, ["Hello, World!"]] } response = etag(app).call(request) response[1]['ETag'].should.be.nil end should "not set ETag if a sendfile_body is given" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, sendfile_body] } response = etag(app).call(request) response[1]['ETag'].should.be.nil end should "not set ETag if a status is not 200 or 201" do app = lambda { |env| [401, {'Content-Type' => 'text/plain'}, ['Access denied.']] } response = etag(app).call(request) response[1]['ETag'].should.be.nil end should "not set ETag if no-cache is given" do app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'Cache-Control' => 'no-cache, must-revalidate'}, ['Hello, World!']] } response = etag(app).call(request) response[1]['ETag'].should.be.nil end should "close the original body" do body = StringIO.new app = lambda { |env| [200, {}, body] } response = etag(app).call(request) body.should.not.be.closed response[2].close body.should.be.closed end end
Upload File
Create Folder