hobbit 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/hobbit/base.rb +7 -7
- data/lib/hobbit/response.rb +1 -1
- data/lib/hobbit/version.rb +1 -1
- data/spec/base_spec.rb +2 -2
- data/spec/response_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8b15402755a98818b63e15b8ee601d015b895b6
|
4
|
+
data.tar.gz: 2cdbe4db16ad8da597f06fa81286ddf8b08fb5a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee1eb6bade97d609f0728a57a1f48ca0abe2629f71479a43bb4f04126e444d629118b47d7a89da13ce272eed024bec0133c668e3b8ee1a848b6f68c74fec001
|
7
|
+
data.tar.gz: 7c5aa60e620e81fa6338f473bb756c94c8b4d01fd07d0ef7df8f90eb601e25a0ebc8001fa4f1004f239135e6755bdfe15cf356f8b091758850b5e8fadae02d94
|
data/CHANGELOG.md
CHANGED
data/lib/hobbit/base.rb
CHANGED
@@ -55,16 +55,16 @@ module Hobbit
|
|
55
55
|
@response.finish
|
56
56
|
end
|
57
57
|
|
58
|
-
# Stops the execution and
|
59
|
-
#
|
60
|
-
# status | Number - HTTP status code
|
61
|
-
# body | Response body
|
62
|
-
# headers | Response headers
|
58
|
+
# Stops the execution and returns a response.
|
63
59
|
#
|
60
|
+
# @param status [Fixnum] HTTP status code.
|
61
|
+
# @param headers [Hash] Response headers.
|
62
|
+
# @param body [Array] Response body.
|
63
|
+
# @return [Hobbit::Response] The Response.
|
64
64
|
def halt(status, headers: {}, body: [])
|
65
|
-
response.status = status
|
65
|
+
response.status = status
|
66
66
|
response.headers = headers
|
67
|
-
response.body = Array(body)
|
67
|
+
response.body = Array(body)
|
68
68
|
|
69
69
|
throw :halt, response
|
70
70
|
end
|
data/lib/hobbit/response.rb
CHANGED
@@ -11,7 +11,7 @@ module Hobbit
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def finish
|
14
|
-
headers['Content-Length'] = body.each.map(&:size).inject { |memo, current| memo += current }
|
14
|
+
headers['Content-Length'] = body.each.map(&:size).inject { |memo, current| memo += current }.to_s
|
15
15
|
[status, headers, body]
|
16
16
|
end
|
17
17
|
|
data/lib/hobbit/version.rb
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -233,7 +233,7 @@ EOS
|
|
233
233
|
|
234
234
|
it 'return the response given to halt function' do
|
235
235
|
get '/halt'
|
236
|
-
last_response.headers.must_equal({ 'Content-Length' =>
|
236
|
+
last_response.headers.must_equal({ 'Content-Length' => '' })
|
237
237
|
last_response.body.must_equal ''
|
238
238
|
last_response.status.must_equal 501
|
239
239
|
end
|
@@ -258,7 +258,7 @@ EOS
|
|
258
258
|
|
259
259
|
it 'accepts headers' do
|
260
260
|
get '/halt_headers'
|
261
|
-
last_response.headers.must_equal({ header: 'OK', 'Content-Length' =>
|
261
|
+
last_response.headers.must_equal({ header: 'OK', 'Content-Length' => '' })
|
262
262
|
last_response.status.must_equal 501
|
263
263
|
end
|
264
264
|
end
|
data/spec/response_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe Hobbit::Response do
|
|
59
59
|
response = Hobbit::Response.new body, status, headers
|
60
60
|
s, h, b = response.finish
|
61
61
|
h.must_include 'Content-Length'
|
62
|
-
h['Content-Length'].must_equal
|
62
|
+
h['Content-Length'].must_equal '17'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patricio Mac Adden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|