Sha256: 819a33e191f40c43013fc8b84b247d95fab97820eeff258e4fa2145dee793588

Contents?: true

Size: 647 Bytes

Versions: 9

Compression:

Stored size: 647 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_be_nil
      header('Content-Length', i.to_s).must_be_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

9 entries across 9 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/drop_body_spec.rb
roda-2.28.0 spec/plugin/drop_body_spec.rb
roda-2.27.0 spec/plugin/drop_body_spec.rb
roda-2.26.0 spec/plugin/drop_body_spec.rb
roda-2.25.0 spec/plugin/drop_body_spec.rb
roda-2.24.0 spec/plugin/drop_body_spec.rb
roda-2.23.0 spec/plugin/drop_body_spec.rb
roda-2.22.0 spec/plugin/drop_body_spec.rb
roda-2.21.0 spec/plugin/drop_body_spec.rb