rack-slashenforce 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +6 -4
  3. data/lib/rack-slashenforce.rb +3 -3
  4. metadata +15 -15
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6603ff9f78fd64516fa8c3cc2bcf5cd261951071
4
+ data.tar.gz: 04735ce48eaebc104fb182ac15c755da3bde2c79
5
+ SHA512:
6
+ metadata.gz: 52299903ea7d245bf4c11aa7a197a3dda72c7eb7e220f4f623eacd1ae6085f8e11e98e0f813a09d802944457c07ff6da63a8746ed9d87f1ffc8eb8891be87ee6
7
+ data.tar.gz: c0fb88bbe665fcf4b40a5051c447bb14081a12d975ef6c6270da5136e65f32266b60524f3d3115513ea629e41b173d4fb0caecc382f663d90eb65e071096475e
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rack::SlashEnforce
1
+ # rack-slashenforce
2
2
 
3
3
  A rack middleware to enforce appending or removing trailing slashes from URLs.
4
4
 
@@ -15,18 +15,20 @@ If you use Bundler, you will need to add it to your *Gemfile*.
15
15
  gem 'rack-slashenforce', :require => 'rack'
16
16
  ```
17
17
 
18
- Add one of the following to config.ru:
18
+ ## Usage
19
+
20
+ Add one of the following lines to *config.ru*:
19
21
 
20
22
  To enforce a trailing slash on all urls without a period in them:
21
23
 
22
24
  ```ruby
23
- use Rack::AppendSlash
25
+ use Rack::AppendTrailingSlash
24
26
  ```
25
27
 
26
28
  To enforce no trailing slashes on any urls:
27
29
 
28
30
  ```ruby
29
- use Rack::RemoveSlash
31
+ use Rack::RemoveTrailingSlashes
30
32
  ```
31
33
 
32
34
  For a more robust solution, see [rack-rewrite](https://github.com/jtrupiano/rack-rewrite).
@@ -2,7 +2,7 @@ module Rack
2
2
 
3
3
  module SlashEnforce
4
4
  def self.version
5
- '0.0.2'
5
+ '0.0.3'
6
6
  end
7
7
  end
8
8
 
@@ -15,7 +15,7 @@ module Rack
15
15
  end
16
16
 
17
17
  def call(env)
18
- if env['PATH_INFO'] != '/' && env['PATH_INFO'] =~ MATCH
18
+ if env['PATH_INFO'] != '/' && env['PATH_INFO'] =~ MATCH && env['REQUEST_METHOD'] == 'GET'
19
19
  env['PATH_INFO'].sub!(/(\/)+$/,'')
20
20
  [301, {"Location" => Rack::Request.new(env).url, "Content-Type" => ""}, []]
21
21
  else
@@ -33,7 +33,7 @@ module Rack
33
33
  end
34
34
 
35
35
  def call(env)
36
- if env['PATH_INFO'] != '/' && env['PATH_INFO'] =~ MATCH
36
+ if env['PATH_INFO'] != '/' && env['PATH_INFO'] =~ MATCH && env['REQUEST_METHOD'] == 'GET'
37
37
  env['PATH_INFO'] += '/'
38
38
  [301, {"Location" => Rack::Request.new(env).url, "Content-Type" => ""}, []]
39
39
  else
metadata CHANGED
@@ -1,61 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-slashenforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tyler Kellen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-03-10 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
- requirement: &70352000862100 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70352000862100
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  description: ''
26
28
  email: tyler@sleekcode.net
27
29
  executables: []
28
30
  extensions: []
29
31
  extra_rdoc_files: []
30
32
  files:
31
- - .gitignore
33
+ - ".gitignore"
32
34
  - LICENSE
33
35
  - README.md
34
36
  - lib/rack-slashenforce.rb
35
37
  - rack-slashenforce.gemspec
36
38
  homepage: https://github.com/tkellen/rack-slashenforce/
37
39
  licenses: []
40
+ metadata: {}
38
41
  post_install_message:
39
42
  rdoc_options: []
40
43
  require_paths:
41
44
  - lib
42
45
  required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
46
  requirements:
45
- - - ! '>='
47
+ - - ">="
46
48
  - !ruby/object:Gem::Version
47
49
  version: '0'
48
50
  required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
51
  requirements:
51
- - - ! '>='
52
+ - - ">="
52
53
  - !ruby/object:Gem::Version
53
54
  version: '0'
54
55
  requirements: []
55
56
  rubyforge_project:
56
- rubygems_version: 1.8.10
57
+ rubygems_version: 2.5.1
57
58
  signing_key:
58
- specification_version: 3
59
+ specification_version: 4
59
60
  summary: A rack middleware to enforce appending or removing trailing slashes.
60
61
  test_files: []
61
- has_rdoc: