Sha256: d00ab427ff38e95972d2860a0cdaf4a807d5c59e4f89c2754a6a3a0c36ce612c

Contents?: true

Size: 726 Bytes

Versions: 9

Compression:

Stored size: 726 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, 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('205').must_equal ''
    header('Content-Type', '205').must_be_nil
    header('Content-Length', '205').must_equal '0'

    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-3.28.0 spec/plugin/drop_body_spec.rb
roda-3.27.0 spec/plugin/drop_body_spec.rb
roda-3.26.0 spec/plugin/drop_body_spec.rb
roda-3.25.0 spec/plugin/drop_body_spec.rb
roda-3.24.0 spec/plugin/drop_body_spec.rb
roda-3.23.0 spec/plugin/drop_body_spec.rb
roda-3.22.0 spec/plugin/drop_body_spec.rb
roda-3.21.0 spec/plugin/drop_body_spec.rb
roda-3.20.0 spec/plugin/drop_body_spec.rb