rack-xslview 0.2.0 → 0.2.1

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rack-xslview.rb +10 -6
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/rack-xslview.rb CHANGED
@@ -19,13 +19,18 @@ module Rack
19
19
  end
20
20
 
21
21
  def call(env)
22
+
22
23
  # No matter what, @app will be called
23
- status, headers, body = @app.call(env)
24
+ status, headers, body = original_response = @app.call(env)
25
+
26
+ return original_response if (status == 304 || status == 204)
27
+
28
+ return original_response unless headers["Content-Type"].to_s.match(/(ht|x)ml/)
24
29
 
25
30
  # If setup includes paths to exclude from xslt processing, check them
26
31
  checknoxsl(env) if @options[:noxsl]
27
32
 
28
- # Obtain entire request body, check to make sure it can be processed
33
+ # Obtain entire request body, ensuring sure it can be processed
29
34
  myxml = getResponse(body)
30
35
 
31
36
  # Should XSL file be reloaded?
@@ -56,8 +61,8 @@ module Rack
56
61
  [status, headers, newbody]
57
62
 
58
63
  rescue XSLViewError
59
- # TODO Logging: "Rack XSLView not processed" if env['RACK_ENV'] == 'development'
60
- [status, headers, body]
64
+ # TODO Log: "Rack XSLView not processed" if env['RACK_ENV'] == 'development'
65
+ original_response
61
66
  end
62
67
 
63
68
  private
@@ -78,7 +83,7 @@ module Rack
78
83
  end
79
84
  def checkForXml(x)
80
85
  # Abort processing if content cannot be processed by libxslt
81
- raise XSLViewError unless x[0,1] == '<'
86
+ raise XSLViewError unless x[0] == '<'
82
87
  if @options[:excludehtml] == true
83
88
  raise XSLViewError if x.include? '<html'
84
89
  end
@@ -95,4 +100,3 @@ module Rack
95
100
  end
96
101
  end
97
102
  end
98
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-xslview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Lash