Sha256: dd22f0d25d3ce9f8c3d281a74064a9d6591dd59732ecb9f5d04732d2f44ab253

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

require_relative "../lib/tynn/force_ssl"

setup do
  Tynn::Test.new
end

test "redirects to https" do |app|
  Tynn.plugin(Tynn::ForceSSL)

  Tynn.define do
  end

  app.get("/")

  assert_equal 301, app.res.status
  assert_equal "https://example.org/", app.res.location
end

test "https request" do |app|
  Tynn.plugin(Tynn::ForceSSL)

  Tynn.define do
    root do
      res.write("secure")
    end
  end

  app.get("/", {}, "HTTPS" => "on")

  assert_equal 200, app.res.status
  assert_equal "secure", app.res.body
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tynn-1.2.0 test/force_ssl_test.rb
tynn-1.1.0 test/force_ssl_test.rb