Sha256: eaf8c15b331e7c0cf689b72e19c5449d2da688f6bf4cce31325b3b4c88d2edb9

Contents?: true

Size: 603 Bytes

Versions: 21

Compression:

Stored size: 603 Bytes

Contents

require_relative "../spec_helper"

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

21 entries across 21 versions & 1 rubygems

Version Path
roda-3.19.0 spec/plugin/drop_body_spec.rb
roda-3.18.0 spec/plugin/drop_body_spec.rb
roda-3.17.0 spec/plugin/drop_body_spec.rb
roda-3.16.0 spec/plugin/drop_body_spec.rb
roda-3.15.0 spec/plugin/drop_body_spec.rb
roda-3.14.1 spec/plugin/drop_body_spec.rb
roda-3.14.0 spec/plugin/drop_body_spec.rb
roda-3.13.0 spec/plugin/drop_body_spec.rb
roda-3.12.0 spec/plugin/drop_body_spec.rb
roda-3.11.0 spec/plugin/drop_body_spec.rb
roda-3.10.0 spec/plugin/drop_body_spec.rb
roda-3.9.0 spec/plugin/drop_body_spec.rb
roda-3.8.0 spec/plugin/drop_body_spec.rb
roda-3.7.0 spec/plugin/drop_body_spec.rb
roda-3.6.0 spec/plugin/drop_body_spec.rb
roda-3.5.0 spec/plugin/drop_body_spec.rb
roda-3.4.0 spec/plugin/drop_body_spec.rb
roda-3.3.0 spec/plugin/drop_body_spec.rb
roda-3.2.0 spec/plugin/drop_body_spec.rb
roda-3.1.0 spec/plugin/drop_body_spec.rb