rack_slashless 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/rack_slashless.rb +1 -1
- data/rack_slashless.gemspec +1 -1
- data/spec/rack_slashless_spec.rb +6 -0
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/lib/rack_slashless.rb
CHANGED
@@ -9,7 +9,7 @@ module Rack
|
|
9
9
|
request = Rack::Request.new(env)
|
10
10
|
if request.get? && request.path_info.match(/.+\/$/)
|
11
11
|
destination = request.url.gsub(/\/(\?.*)?$/,'\1')
|
12
|
-
[301, {'Location' => destination}, ["Redirecting to #{destination}"]]
|
12
|
+
[301, {'Location' => destination, 'Content-Type' => 'text/html'}, ["Redirecting to #{destination}"]]
|
13
13
|
else
|
14
14
|
@app.call(env)
|
15
15
|
end
|
data/rack_slashless.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.test_files = `git ls-files -- spec/*`.split("\n")
|
9
9
|
gem.name = "rack_slashless"
|
10
10
|
gem.require_paths = ["lib"]
|
11
|
-
gem.version = "0.0.
|
11
|
+
gem.version = "0.0.8"
|
12
12
|
gem.license = "MIT"
|
13
13
|
|
14
14
|
gem.add_development_dependency 'rspec', '>= 2'
|
data/spec/rack_slashless_spec.rb
CHANGED
@@ -30,6 +30,12 @@ describe Rack::Slashless do
|
|
30
30
|
last_response.status.should == 301
|
31
31
|
last_response['Location'].should eql('http://example.org/blog')
|
32
32
|
end
|
33
|
+
|
34
|
+
it 'should redirect and provide a Content-Type' do
|
35
|
+
get '/blog/', {}, 'HTTP_HOST' => 'example.org'
|
36
|
+
last_response.status.should == 301
|
37
|
+
last_response['Content-Type'].should eql('text/html')
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
context 'with a query string' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack_slashless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -88,3 +88,4 @@ summary: Performs a 301 redirection on every url ending by a /
|
|
88
88
|
test_files:
|
89
89
|
- spec/rack_slashless_spec.rb
|
90
90
|
- spec/spec_helper.rb
|
91
|
+
has_rdoc:
|