cuba 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fc1228862c8a441f9246f55475c5794761605b8
4
- data.tar.gz: e5ddde6ab8c8e56c15910551eca0e49960b29c31
3
+ metadata.gz: 51a2e9df839f23563e53c9a4a7bc93657b55a781
4
+ data.tar.gz: 43432f0a85b2133cc1b052dd2f8ac4bf88eea0a2
5
5
  SHA512:
6
- metadata.gz: 8eb9986361bbdbee4d60ed75167870d37bbd16b38aa676a73cc3c5e0f0831c3c4654464f192d015cfd1a0b796858e4389087206e4fb72fa81ef57c1d79f630e8
7
- data.tar.gz: f7e6ab58e6517f5768e2773bafcc4a2d8f0d01462be4c443079085b3142813c21eaaebf65cad9c096eb2513e60ca091cc041d3f00c9697aea85ec05879265dc1
6
+ metadata.gz: a8e53ef5c9a833d709bd095138aeb9b57be355d3758428c396e864a4b81d381615594a0c33977cdd960b727588178ba1ef8d2e87bec379ca84054abcd1d7f173
7
+ data.tar.gz: aa4fb0f2247bb8568fba9b38374a423ddee945972fe4143d97d5f488bdad2a08832c2581bbdc51d8c3726446cf5daf4f9a715215df713c911f44629e05d39e46
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 3.3.0
2
+
3
+ * Restrict when to add the default content type.
4
+
1
5
  3.2.0
2
6
 
3
7
  * Return 404 when status is not explicitly set and body is empty.
data/README.md CHANGED
@@ -481,7 +481,7 @@ require "erb"
481
481
  Cuba.plugin(Cuba::Render)
482
482
  ```
483
483
 
484
- This example use ERB, a template engine that comes with Ruby. If you want to
484
+ This example uses ERB, a template engine that comes with Ruby. If you want to
485
485
  use another template engine, one [supported by Tilt][templates], you need to
486
486
  install the required gem and change the `template_engine` setting as shown
487
487
  below.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cuba"
3
- s.version = "3.2.0"
3
+ s.version = "3.3.0"
4
4
  s.summary = "Microframework for web applications."
5
5
  s.description = "Cuba is a microframework for web applications."
6
6
  s.authors = ["Michel Martens"]
@@ -8,9 +8,7 @@ class Cuba
8
8
  attr :body
9
9
  attr :headers
10
10
 
11
- def initialize(status = nil,
12
- headers = { "Content-Type" => "text/html; charset=utf-8" })
13
-
11
+ def initialize(status = nil, headers = {})
14
12
  @status = status
15
13
  @headers = headers
16
14
  @body = []
@@ -185,6 +183,7 @@ class Cuba
185
183
  if res.body.empty?
186
184
  res.status = 404
187
185
  else
186
+ res.headers["Content-Type"] ||= "text/html; charset=utf-8"
188
187
  res.status = 200
189
188
  end
190
189
  end
@@ -16,8 +16,6 @@ test "redirect" do
16
16
  status, headers, body = Cuba.call(env)
17
17
 
18
18
  assert_equal status, 302
19
- assert_equal headers, {
20
- "Content-Type" => "text/html; charset=utf-8",
21
- "Location" => "/hello" }
19
+ assert_equal headers, { "Location" => "/hello" }
22
20
  assert_response body, []
23
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuba
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-10 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack