Sha256: 60cdcf03ebf4cea161ded8d507dad5d7d38a44b4b3f1cda32c44ac8ac4a03fe1

Contents?: true

Size: 653 Bytes

Versions: 19

Compression:

Stored size: 653 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "drop_body plugin" do 
  it "automatically drops body and Content-Type/Content-Length headers for responses without a body" do
    app(:drop_body) do |r|
      response.status = r.path.to_i
      response.write('a')
    end

    [101, 102, 204, 205, 304].each do  |i|
      body(i.to_s).must_equal ''
      header('Content-Type', i.to_s).must_equal nil
      header('Content-Length', i.to_s).must_equal nil
    end

    body('200').must_equal 'a'
    header('Content-Type', '200').must_equal 'text/html'
    header('Content-Length', '200').must_equal '1'
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
roda-2.20.0 spec/plugin/drop_body_spec.rb
roda-2.19.0 spec/plugin/drop_body_spec.rb
roda-2.18.0 spec/plugin/drop_body_spec.rb
roda-2.17.0 spec/plugin/drop_body_spec.rb
roda-2.16.0 spec/plugin/drop_body_spec.rb
roda-2.15.0 spec/plugin/drop_body_spec.rb
roda-2.14.0 spec/plugin/drop_body_spec.rb
roda-2.13.0 spec/plugin/drop_body_spec.rb
roda-2.12.0 spec/plugin/drop_body_spec.rb
roda-2.11.0 spec/plugin/drop_body_spec.rb
roda-2.10.0 spec/plugin/drop_body_spec.rb
roda-2.9.0 spec/plugin/drop_body_spec.rb
roda-2.8.0 spec/plugin/drop_body_spec.rb
roda-2.7.0 spec/plugin/drop_body_spec.rb
roda-2.6.0 spec/plugin/drop_body_spec.rb
roda-2.5.1 spec/plugin/drop_body_spec.rb
roda-2.5.0 spec/plugin/drop_body_spec.rb
roda-2.4.0 spec/plugin/drop_body_spec.rb
roda-2.3.0 spec/plugin/drop_body_spec.rb