goliath 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of goliath might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/examples/rasterize/rasterize.rb +1 -1
- data/goliath.gemspec +1 -0
- data/lib/goliath/connection.rb +16 -12
- data/lib/goliath/constants.rb +1 -0
- data/lib/goliath/rack/default_response_format.rb +3 -9
- data/lib/goliath/rack/formatters/json.rb +1 -1
- data/lib/goliath/rack/params.rb +1 -1
- data/lib/goliath/rack/templates.rb +1 -1
- data/lib/goliath/request.rb +35 -18
- data/lib/goliath/response.rb +3 -1
- data/lib/goliath/server.rb +1 -1
- data/lib/goliath/version.rb +1 -1
- data/spec/integration/async_request_processing.rb +2 -2
- data/spec/integration/chunked_streaming_spec.rb +1 -1
- data/spec/integration/early_abort_spec.rb +5 -5
- data/spec/integration/echo_spec.rb +7 -7
- data/spec/integration/empty_body_spec.rb +2 -2
- data/spec/integration/event_stream_spec.rb +3 -3
- data/spec/integration/exception_handling_spec.rb +16 -16
- data/spec/integration/http_log_spec.rb +16 -16
- data/spec/integration/jsonp_spec.rb +6 -6
- data/spec/integration/keepalive_spec.rb +2 -2
- data/spec/integration/pipelining_spec.rb +3 -3
- data/spec/integration/reloader_spec.rb +3 -3
- data/spec/integration/template_spec.rb +7 -7
- data/spec/integration/test_helper_spec.rb +3 -3
- data/spec/integration/trace_spec.rb +2 -2
- data/spec/integration/valid_spec.rb +8 -8
- data/spec/integration/websocket_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -3
- data/spec/unit/api_spec.rb +1 -1
- data/spec/unit/connection_spec.rb +8 -8
- data/spec/unit/console_spec.rb +3 -3
- data/spec/unit/env_spec.rb +9 -9
- data/spec/unit/headers_spec.rb +8 -8
- data/spec/unit/rack/default_mime_type_spec.rb +3 -3
- data/spec/unit/rack/formatters/json_spec.rb +35 -13
- data/spec/unit/rack/formatters/plist_spec.rb +8 -8
- data/spec/unit/rack/formatters/xml_spec.rb +18 -18
- data/spec/unit/rack/formatters/yaml_spec.rb +13 -13
- data/spec/unit/rack/heartbeat_spec.rb +15 -15
- data/spec/unit/rack/params_spec.rb +62 -60
- data/spec/unit/rack/render_spec.rb +14 -14
- data/spec/unit/rack/validation/boolean_value_spec.rb +6 -6
- data/spec/unit/rack/validation/default_params_spec.rb +13 -13
- data/spec/unit/rack/validation/numeric_range_spec.rb +17 -17
- data/spec/unit/rack/validation/param_spec.rb +75 -75
- data/spec/unit/rack/validation/request_method_spec.rb +9 -9
- data/spec/unit/rack/validation/required_param_spec.rb +28 -28
- data/spec/unit/rack/validation/required_value_spec.rb +19 -19
- data/spec/unit/request_spec.rb +18 -18
- data/spec/unit/response_spec.rb +6 -6
- data/spec/unit/runner_spec.rb +31 -31
- data/spec/unit/server_spec.rb +21 -21
- data/spec/unit/validation/standard_http_errors_spec.rb +6 -6
- metadata +20 -7
data/spec/unit/server_spec.rb
CHANGED
@@ -8,50 +8,50 @@ describe Goliath::Server do
|
|
8
8
|
|
9
9
|
describe 'defaults' do
|
10
10
|
it 'to any interface' do
|
11
|
-
@s.address.
|
11
|
+
expect(@s.address).to eq('0.0.0.0')
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'to port 9000' do
|
15
|
-
@s.port.
|
15
|
+
expect(@s.port).to eq(9000)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
describe 'configuration' do
|
20
20
|
it 'accepts an address and port' do
|
21
21
|
@s = Goliath::Server.new('10.2.1.1', 2020)
|
22
|
-
@s.address.
|
23
|
-
@s.port.
|
22
|
+
expect(@s.address).to eq('10.2.1.1')
|
23
|
+
expect(@s.port).to eq(2020)
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'accepts a logger' do
|
27
27
|
logger = double('logger')
|
28
28
|
@s.logger = logger
|
29
|
-
@s.logger.
|
29
|
+
expect(@s.logger).to eq(logger)
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'accepts an app' do
|
33
33
|
app = double('app')
|
34
34
|
@s.app = app
|
35
|
-
@s.app.
|
35
|
+
expect(@s.app).to eq(app)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'accepts config' do
|
39
39
|
config = double('config')
|
40
40
|
@s.config = config
|
41
|
-
@s.config.
|
41
|
+
expect(@s.config).to eq(config)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'startup' do
|
46
46
|
before(:each) do
|
47
|
-
EM.
|
47
|
+
expect(EM).to receive(:synchrony).and_yield
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'starts' do
|
51
51
|
addr = '10.2.1.1'
|
52
52
|
port = 10000
|
53
53
|
|
54
|
-
EM.
|
54
|
+
expect(EM).to receive(:start_server).with(addr, port, anything)
|
55
55
|
|
56
56
|
@s.address = addr
|
57
57
|
@s.port = port
|
@@ -62,9 +62,9 @@ describe Goliath::Server do
|
|
62
62
|
app = double('application')
|
63
63
|
|
64
64
|
conn = double("connection").as_null_object
|
65
|
-
conn.
|
65
|
+
expect(conn).to receive(:app=).with(app)
|
66
66
|
|
67
|
-
EM.
|
67
|
+
expect(EM).to receive(:start_server).and_yield(conn)
|
68
68
|
|
69
69
|
@s.app = app
|
70
70
|
@s.start
|
@@ -74,9 +74,9 @@ describe Goliath::Server do
|
|
74
74
|
logger = double('logger')
|
75
75
|
|
76
76
|
conn = double("connection").as_null_object
|
77
|
-
conn.
|
77
|
+
expect(conn).to receive(:logger=).with(logger)
|
78
78
|
|
79
|
-
EM.
|
79
|
+
expect(EM).to receive(:start_server).and_yield(conn)
|
80
80
|
|
81
81
|
@s.logger = logger
|
82
82
|
@s.start
|
@@ -86,9 +86,9 @@ describe Goliath::Server do
|
|
86
86
|
status = double('status')
|
87
87
|
|
88
88
|
conn = double("connection").as_null_object
|
89
|
-
conn.
|
89
|
+
expect(conn).to receive(:status=).with(status)
|
90
90
|
|
91
|
-
EM.
|
91
|
+
expect(EM).to receive(:start_server).and_yield(conn)
|
92
92
|
|
93
93
|
@s.status = status
|
94
94
|
@s.start
|
@@ -96,9 +96,9 @@ describe Goliath::Server do
|
|
96
96
|
|
97
97
|
it 'loads the config for each connection' do
|
98
98
|
conn = double("connection").as_null_object
|
99
|
-
EM.
|
99
|
+
expect(EM).to receive(:start_server).and_yield(conn)
|
100
100
|
|
101
|
-
@s.
|
101
|
+
expect(@s).to receive(:load_config)
|
102
102
|
@s.start
|
103
103
|
end
|
104
104
|
end
|
@@ -113,28 +113,28 @@ describe Goliath::Server do
|
|
113
113
|
Goliath.env = :development
|
114
114
|
block_run = false
|
115
115
|
@s.environment('development') { block_run = true }
|
116
|
-
block_run.
|
116
|
+
expect(block_run).to be true
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'does not execute the block if the environment does not match' do
|
120
120
|
Goliath.env = :development
|
121
121
|
block_run = false
|
122
122
|
@s.environment('test') { block_run = true }
|
123
|
-
block_run.
|
123
|
+
expect(block_run).to be false
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'accepts an array of environments' do
|
127
127
|
Goliath.env = :development
|
128
128
|
block_run = false
|
129
129
|
@s.environment(['development', 'test']) { block_run = true }
|
130
|
-
block_run.
|
130
|
+
expect(block_run).to be true
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'does not run the block if the environment is not in the array' do
|
134
134
|
Goliath.env = :production
|
135
135
|
block_run = false
|
136
136
|
@s.environment(['development', 'test']) { block_run = true }
|
137
|
-
block_run.
|
137
|
+
expect(block_run).to be false
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -3,19 +3,19 @@ require 'goliath/validation/standard_http_errors'
|
|
3
3
|
|
4
4
|
describe Goliath::Validation::Error do
|
5
5
|
it 'defines exceptions for each standard error response' do
|
6
|
-
|
7
|
-
Goliath::Validation::BadRequestError.
|
6
|
+
expect { Goliath::Validation::BadRequestError.new }.not_to raise_error
|
7
|
+
expect(Goliath::Validation::BadRequestError).to be < Goliath::Validation::Error
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'defines InternalServerError not InternalServerErrorError' do
|
11
|
-
|
12
|
-
Goliath::Validation::InternalServerError.
|
11
|
+
expect { Goliath::Validation::InternalServerError.new }.not_to raise_error
|
12
|
+
expect(Goliath::Validation::InternalServerError).to be < Goliath::Validation::Error
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'sets a default status code and message' do
|
16
16
|
nfe = Goliath::Validation::NotFoundError.new
|
17
|
-
nfe.status_code.
|
18
|
-
nfe.message.
|
17
|
+
expect(nfe.status_code).to eq('404')
|
18
|
+
expect(nfe.message).to eq('Not Found')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goliath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dan sinclair
|
8
8
|
- Ilya Grigorik
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -319,6 +319,20 @@ dependencies:
|
|
319
319
|
- - ">="
|
320
320
|
- !ruby/object:Gem::Version
|
321
321
|
version: '0'
|
322
|
+
- !ruby/object:Gem::Dependency
|
323
|
+
name: rack
|
324
|
+
requirement: !ruby/object:Gem::Requirement
|
325
|
+
requirements:
|
326
|
+
- - "<"
|
327
|
+
- !ruby/object:Gem::Version
|
328
|
+
version: '2'
|
329
|
+
type: :development
|
330
|
+
prerelease: false
|
331
|
+
version_requirements: !ruby/object:Gem::Requirement
|
332
|
+
requirements:
|
333
|
+
- - "<"
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
version: '2'
|
322
336
|
- !ruby/object:Gem::Dependency
|
323
337
|
name: tilt
|
324
338
|
requirement: !ruby/object:Gem::Requirement
|
@@ -646,7 +660,7 @@ files:
|
|
646
660
|
homepage: http://goliath.io/
|
647
661
|
licenses: []
|
648
662
|
metadata: {}
|
649
|
-
post_install_message:
|
663
|
+
post_install_message:
|
650
664
|
rdoc_options: []
|
651
665
|
require_paths:
|
652
666
|
- lib
|
@@ -661,9 +675,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
661
675
|
- !ruby/object:Gem::Version
|
662
676
|
version: '0'
|
663
677
|
requirements: []
|
664
|
-
|
665
|
-
|
666
|
-
signing_key:
|
678
|
+
rubygems_version: 3.1.6
|
679
|
+
signing_key:
|
667
680
|
specification_version: 4
|
668
681
|
summary: Async framework for writing API servers
|
669
682
|
test_files:
|