utopia 2.9.3 → 2.9.5

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
  SHA256:
3
- metadata.gz: db64f031384dae4906f299b717d3fa42eb28420f4c0f429bfa3570829b2c3cb2
4
- data.tar.gz: 3136b4bdbf002feef0ee9750e5c9c81d281bc4afa54817d1ab7bb0f4819dd0ef
3
+ metadata.gz: 96bc613a811559da9b85d83e9bf9465874582cf1bc6cb6bca7b8fe93d0768290
4
+ data.tar.gz: 3e9a80e381f58ee71c455999e1ff6d5600ce2c34c8c2d7cad1742fe9c6bd0f47
5
5
  SHA512:
6
- metadata.gz: 45613d14cbc42755a59494d0214593214e5c7563b18b73fd884ee706c017cd1b8ddf6fbefafffc7e96ad4f9827c1933c23002b73e6572343ef99b8708d4d1cef
7
- data.tar.gz: d6f91102afa0d8ec2e05d9155f3442d9397cd1f241e87e554576e8607abef124e25d8d164fc4d6c6ec87fa35439d46c7820f9885dbab235a02bb609e24d215d6
6
+ metadata.gz: 948b833d0e28b70f133127ede3efe3eacde864b4fc8d56ade1aa11f308bce613d3cb7e5c2d4c303dcc06f7740cf39da4933c80758c7ea21029692e1524cb4f66
7
+ data.tar.gz: d74697bf496eecec19821b678a2aaf47cd886327006a8b5cad94bccdbfb4f62726228009a57d3acf8814234db8ccdcb0918956b22f2effd4499b42fa39a7da5c
@@ -64,7 +64,7 @@ module Utopia
64
64
 
65
65
  # To accept incoming requests with content-type JSON (e.g. POST with JSON data), consider using `Rack::PostBodyContentTypeParser`.
66
66
  module ToJSON
67
- APPLICATION_JSON = HTTP::Accept::ContentType.new('application/json', charset: 'utf-8').freeze
67
+ APPLICATION_JSON = HTTP::Accept::ContentType.new('application', 'json', charset: 'utf-8').freeze
68
68
  HEADERS = {HTTP::CONTENT_TYPE => APPLICATION_JSON.to_s}.freeze
69
69
 
70
70
  def self.content_type
@@ -94,7 +94,7 @@ module Utopia
94
94
  end
95
95
 
96
96
  module Passthrough
97
- WILDCARD = HTTP::Accept::MediaTypes::MediaRange.new('*/*').freeze
97
+ WILDCARD = HTTP::Accept::MediaTypes::MediaRange.new('*', '*').freeze
98
98
 
99
99
  def self.split(*args)
100
100
  self.media_range.split(*args)
@@ -81,6 +81,20 @@ module Utopia
81
81
  :user_agent,
82
82
  ]
83
83
 
84
+ def generate_backtrace(io, exception, prefix: "Exception")
85
+ io.puts "#{prefix} #{exception.class.name}: #{exception.to_s}"
86
+
87
+ if exception.respond_to?(:backtrace)
88
+ io.puts exception.backtrace
89
+ else
90
+ io.puts exception.to_s
91
+ end
92
+
93
+ if cause = exception.cause
94
+ generate_backtrace(io, cause, prefix: "Caused by")
95
+ end
96
+ end
97
+
84
98
  def generate_body(exception, env)
85
99
  io = StringIO.new
86
100
 
@@ -111,13 +125,7 @@ module Utopia
111
125
 
112
126
  io.puts
113
127
 
114
- io.puts "#{exception.class.name}: #{exception.to_s}"
115
-
116
- if exception.respond_to?(:backtrace)
117
- io.puts exception.backtrace
118
- else
119
- io.puts exception.to_s
120
- end
128
+ generate_backtrace(io, exception)
121
129
 
122
130
  return io.string
123
131
  end
@@ -55,7 +55,7 @@ module Utopia
55
55
  CONTENT_TYPE = 'Content-Type'.freeze
56
56
 
57
57
  def unhandled_error?(response)
58
- response[0] >= 400 && !response[1].include?(CONTENT_TYPE)
58
+ response[0] >= 400 && response[1].empty?
59
59
  end
60
60
 
61
61
  def call(env)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "2.9.3"
22
+ VERSION = "2.9.5"
23
23
  end
@@ -26,6 +26,7 @@ require 'json'
26
26
 
27
27
  require 'utopia/content'
28
28
  require 'utopia/controller'
29
+ require 'utopia/redirection'
29
30
 
30
31
  module Utopia::Controller::RespondSpec
31
32
  describe Utopia::Controller do
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency 'rack', '~> 2.0'
34
34
 
35
- spec.add_dependency 'http-accept', '~> 1.6'
35
+ spec.add_dependency 'http-accept', '~> 2.1'
36
36
 
37
37
  spec.add_dependency 'mail', '~> 2.6'
38
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.3
4
+ version: 2.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-28 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trenni
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.6'
103
+ version: '2.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.6'
110
+ version: '2.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: mail
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -792,7 +792,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
792
792
  - !ruby/object:Gem::Version
793
793
  version: '0'
794
794
  requirements: []
795
- rubygems_version: 3.0.3
795
+ rubygems_version: 3.0.4
796
796
  signing_key:
797
797
  specification_version: 4
798
798
  summary: Utopia is a framework for building dynamic content-driven websites.