lydia 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90fa262cf72761e1c2ac13b898504e3216950b23
4
- data.tar.gz: 637bc940ba3a7cb2a6fe46594315d63c8c233cd2
3
+ metadata.gz: 55cecde25fdd99b6c28cc496d6601b3272dcc98c
4
+ data.tar.gz: 07bcf6ebe3fb947b7b4acd65ff6cbe4d5a17b3d9
5
5
  SHA512:
6
- metadata.gz: 97f5a3dc0bdcf5baf7d5c3d52ce39b247142bf364d43604f2d0c1c3367aff5f18acd2db943b69b9c916f8a1106c1454bce1afcb2230aa131c2c7d2fdb397860c
7
- data.tar.gz: 5b104d388ce7ebd061cd01fbdff890365f8fa39c922955263702b9d930c13be6e13779be281d29c678d49d5428d456c9fecef3e40b642739d7a181d806173086
6
+ metadata.gz: f1537f5c0912af847b86abe97a89cef2eb2c904752cb30acba86c0573fd42a4b4b144344d262f79d5651ef630d6b25b7cce3045d72f06a86444e5d35c55d25cf
7
+ data.tar.gz: db7d800dfd02255d7c734d3d00b425da53264880f4671bf3f6e009e9051b030053d28574a660a44289c4f82b0358a93aaddda4861716e69b98b409e7103d8558
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .DS_Store
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1
7
7
  - 2.2
8
+ - 2.3.0
8
9
  - rbx-2
9
10
  - jruby
10
11
  before_install: gem install bundler -v 1.10.6
@@ -30,5 +30,18 @@ module Lydia
30
30
  end
31
31
  finish
32
32
  end
33
+
34
+ def finish(&block)
35
+ @block = block
36
+
37
+ if [204, 205, 304].include?(status.to_i)
38
+ headers.delete 'Content-Length'
39
+ headers.delete 'Content-Type'
40
+ close
41
+ [status.to_i, header, []]
42
+ else
43
+ [status.to_i, header, @body]
44
+ end
45
+ end
33
46
  end
34
47
  end
data/lib/lydia/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lydia
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -13,9 +13,9 @@ describe "Middleware" do
13
13
  end
14
14
 
15
15
  def call(env)
16
- result = @app.call(env)
17
- result[2].body[0] = result[2].body[0].upcase
18
- result
16
+ status, headers, body = @app.call(env)
17
+ upcased_body = body.map { |chunk| chunk.upcase }
18
+ [status, headers, upcased_body]
19
19
  end
20
20
  end
21
21
 
@@ -27,8 +27,8 @@ describe 'Response' do
27
27
  expect(result[0]).to eq(200)
28
28
  expect(result[1]).to include('Content-Type' => 'text/html')
29
29
  expect(result[1]).to include('Content-Length' => body.length.to_s)
30
- expect(result[2].body).to be_an(Array)
31
- expect(result[2].body[0]).to eq(body)
30
+ expect(result[2]).to be_an(Array)
31
+ expect(result[2][0]).to eq(body)
32
32
  end
33
33
 
34
34
  it 'builds using a fixnum (status)' do
@@ -51,8 +51,8 @@ describe 'Response' do
51
51
  expect(result[0]).to eq(200)
52
52
  expect(result[1]).to include('Content-Type' => 'application/json')
53
53
  expect(result[1]).to include('Content-Length' => body.to_json.length.to_s)
54
- expect(result[2].body).to be_an(Array)
55
- expect(result[2].body[0]).to eq(body.to_json)
54
+ expect(result[2]).to be_an(Array)
55
+ expect(result[2][0]).to eq(body.to_json)
56
56
  end
57
57
 
58
58
  it 'builds using an array of two (body is array)' do
@@ -63,8 +63,8 @@ describe 'Response' do
63
63
  expect(result[0]).to eq(201)
64
64
  expect(result[1]).to include('Content-Type' => 'text/html')
65
65
  expect(result[1]).to include('Content-Length' => body[1][0].length.to_s)
66
- expect(result[2].body).to be_an(Array)
67
- expect(result[2].body[0]).to eq(body[1][0])
66
+ expect(result[2]).to be_an(Array)
67
+ expect(result[2][0]).to eq(body[1][0])
68
68
  end
69
69
 
70
70
  it 'builds using an array of two (body is noy an array)' do
@@ -75,8 +75,8 @@ describe 'Response' do
75
75
  expect(result[0]).to eq(201)
76
76
  expect(result[1]).to include('Content-Type' => 'text/html')
77
77
  expect(result[1]).to include('Content-Length' => body[1].length.to_s)
78
- expect(result[2].body).to be_an(Array)
79
- expect(result[2].body[0]).to eq(body[1])
78
+ expect(result[2]).to be_an(Array)
79
+ expect(result[2][0]).to eq(body[1])
80
80
  end
81
81
 
82
82
  it 'builds using an array of three' do
@@ -88,8 +88,8 @@ describe 'Response' do
88
88
  expect(result[1]).to include('Content-Type' => 'text/html')
89
89
  expect(result[1]).to include('Content-Length' => body[2].length.to_s)
90
90
  expect(result[1]).to include('Authentication' => '12345')
91
- expect(result[2].body).to be_an(Array)
92
- expect(result[2].body[0]).to eq(body[2])
91
+ expect(result[2]).to be_an(Array)
92
+ expect(result[2][0]).to eq(body[2])
93
93
  end
94
94
 
95
95
  class Stream
@@ -113,8 +113,8 @@ describe 'Response' do
113
113
  expect(result[0]).to eq(200)
114
114
  expect(result[1]).to include('Content-Type' => 'text/html')
115
115
  expect(result[1]).to include('Content-Length')
116
- expect(result[2].body).to be_an(Array)
117
- expect(result[2].body[0]).to_not be_nil
116
+ expect(result[2]).to be_an(Array)
117
+ expect(result[2][0]).to_not be_nil
118
118
  end
119
119
 
120
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lydia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mirko Mignini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.5.1
189
+ rubygems_version: 2.2.2
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Lightweight, fast and easy to use small ruby web framework.