tiny_site 0.2.1 → 0.2.2

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/lib/tiny_site.rb CHANGED
@@ -83,8 +83,7 @@ class TinySite
83
83
  end
84
84
 
85
85
  class TinySite
86
- attr_reader :file_path, :file_path_postfix, :file_extension, :image_path, :request_path, :query_string,
87
- :request_path, :query_string
86
+ attr_reader :file_path, :file_path_postfix, :file_extension, :image_path, :request_path, :query_string
88
87
 
89
88
  def initialize(opts)
90
89
  @file_path = opts[:file_path]
@@ -132,6 +131,10 @@ class TinySite
132
131
  CachedHttpFile.bust and return { 'Cache-Control' => 'no-cache' }
133
132
  end
134
133
 
134
+ def headers
135
+ caching_header.merge({'Content-Type' => 'text/html'})
136
+ end
137
+
135
138
  def view
136
139
  @view ||= View.new self
137
140
  end
@@ -139,10 +142,11 @@ class TinySite
139
142
  def call(env)
140
143
  @request_path, @query_string = env['PATH_INFO'], env['QUERY_STRING']
141
144
 
142
- return [301, {'Location' => @request_path}, ''] if @request_path.gsub!(/(.)\/$/,'\\1')
143
- [status, caching_header, body]
145
+ return [301, {'Location' => @request_path}, ['']] if @request_path.gsub!(/(.)\/$/,'\\1')
146
+
147
+ [status, headers, [body]]
144
148
  rescue => e
145
149
  puts "#{e.class}: #{e.message} #{e.backtrace}"
146
- [500, {}, 'Sorry, but something went wrong']
150
+ [500, {}, ['Sorry, but something went wrong']]
147
151
  end
148
152
  end
@@ -1,3 +1,3 @@
1
1
  class TinySite
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tiny_site
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Niko Dittmann