four_o_four 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/four_o_four.gemspec +3 -1
- data/lib/four_o_four.rb +12 -2
- data/lib/four_o_four/version.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dd1e55a2f069ab329fd348d7a47b4f64f90fdf5
|
4
|
+
data.tar.gz: bc3ca6d87528d1656a3b524a7cea88fd98a28576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d89eedbc78a921ce76a6aff9b74a1f676e542b663d5bec715f38bfab812e4a6107f8246c9e2693f3989f7bb2cf7fcad2d28b5965612263ff2f1ce9517131f5
|
7
|
+
data.tar.gz: 1ada552b2c4bdd704343e61ff70f818d3bd104d3b82cda136c42afe1cdd60e43739da031235cbe4c9c20a990034de7f3aba4e277996ff1f35a5bf3d87c1af4ca
|
data/four_o_four.gemspec
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
|
+
require 'four_o_four/version'
|
6
|
+
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = 'four_o_four'
|
7
|
-
spec.version =
|
9
|
+
spec.version = FourOFour::VERSION
|
8
10
|
spec.authors = ['Espartaco Palma']
|
9
11
|
spec.email = ['esparta@gmail.com']
|
10
12
|
|
data/lib/four_o_four.rb
CHANGED
@@ -3,7 +3,6 @@ require 'utils/asset'
|
|
3
3
|
|
4
4
|
# A small Rack middleware to handle 404 responses with a delegation
|
5
5
|
class FourOFour
|
6
|
-
VERSION = '0.0.3'
|
7
6
|
|
8
7
|
def initialize(app, delegation = nil, skip_formats = [])
|
9
8
|
@app = app
|
@@ -14,7 +13,8 @@ class FourOFour
|
|
14
13
|
def call(env)
|
15
14
|
status, headers, response = @app.call(env)
|
16
15
|
|
17
|
-
if !Utils::Asset.match(env['REQUEST_URI']) &&
|
16
|
+
if processable_request_method?(env) && !Utils::Asset.match(env['REQUEST_URI']) &&
|
17
|
+
can_process_request?(status, headers)
|
18
18
|
Object.const_get(@delegation).new.call(env)
|
19
19
|
else
|
20
20
|
[status, headers, response]
|
@@ -61,4 +61,14 @@ class FourOFour
|
|
61
61
|
def processable_type?(content_type)
|
62
62
|
content_type.nil? || (content_type && content_type !~ @skip_formats)
|
63
63
|
end
|
64
|
+
|
65
|
+
# Return true if the request method is a GET
|
66
|
+
#
|
67
|
+
# @param [Hash] env Rack environment
|
68
|
+
# @return [Boolean]
|
69
|
+
#
|
70
|
+
# @api private
|
71
|
+
def processable_request_method?(env)
|
72
|
+
env['REQUEST_METHOD'] == 'GET'
|
73
|
+
end
|
64
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: four_o_four
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Espartaco Palma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- bin/setup
|
204
204
|
- four_o_four.gemspec
|
205
205
|
- lib/four_o_four.rb
|
206
|
+
- lib/four_o_four/version.rb
|
206
207
|
- lib/utils/asset.rb
|
207
208
|
homepage: https://github.com/SparkHub/four_o_four
|
208
209
|
licenses:
|