Skip to content

Commit 4034b58

Browse files
committed
add support for Sinatra 4
1 parent 85a5171 commit 4034b58

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.github/workflows/ruby.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
ruby-version: ['3.0', '3.1', '3.2']
1616
activesupport-version: ['6', '7']
17-
sinatra-version: ['2', '3']
17+
sinatra-version: ['2', '3', '4']
1818
env:
1919
ACTIVESUPPORT_MAJOR: ${{ matrix.activesupport-version }}
2020
SINATRA_MAJOR: ${{ matrix.sinatra-version }}

lib/pliny/errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Error < StandardError
44
attr_accessor :id
55

66
def self.render(error)
7-
headers = { "Content-Type" => "application/json; charset=utf-8" }
7+
headers = { "content-type" => "application/json; charset=utf-8" }
88
data = { id: error.id, message: error.message }
99
[error.status, headers, [MultiJson.encode(data)]]
1010
end

lib/pliny/middleware/cors.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ def allow_headers
4444

4545
def cors_headers(env)
4646
{
47-
'Access-Control-Allow-Origin' => env["HTTP_ORIGIN"],
48-
'Access-Control-Allow-Methods' => ALLOW_METHODS.join(', '),
49-
'Access-Control-Allow-Headers' => allow_headers.join(', '),
50-
'Access-Control-Allow-Credentials' => "true",
51-
'Access-Control-Max-Age' => "1728000",
52-
'Access-Control-Expose-Headers' => EXPOSE_HEADERS.join(', ')
47+
'access-control-allow-origin' => env["HTTP_ORIGIN"],
48+
'access-control-allow-methods' => ALLOW_METHODS.join(', '),
49+
'access-control-allow-headers' => allow_headers.join(', '),
50+
'access-control-allow-credentials' => "true",
51+
'access-control-max-age' => "1728000",
52+
'access-control-expose-headers' => EXPOSE_HEADERS.join(', ')
5353
}
5454
end
5555
end

lib/pliny/middleware/versioning.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def detect_api_version(env)
2626
error = { id: :bad_version, message: <<-eos }
2727
Please specify a version along with the MIME type. For example, `Accept: application/vnd.#{@app_name}+json; version=1`.
2828
eos
29-
return [400, { "Content-Type" => "application/json; charset=utf-8" },
29+
return [400, { "content-type" => "application/json; charset=utf-8" },
3030
[MultiJson.encode(error)]]
3131
end
3232

pliny.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Gem::Specification.new do |gem|
2020
gem.add_dependency "prmd", "~> 0.11", ">= 0.11.4"
2121

2222

23-
gem.add_dependency "sinatra", ">= 2.0", "< 4.0"
23+
gem.add_dependency "sinatra", ">= 2.0", "< 5.0"
2424
gem.add_dependency "http_accept", "~> 0.1", ">= 0.1.5"
2525
gem.add_dependency "sinatra-router", "~> 0.2", ">= 0.2.4"
2626
gem.add_dependency "thor", ">= 0.19", "< 2.0"
2727

2828
gem.add_development_dependency "rake", "~> 13.0"
29-
gem.add_development_dependency "rack-test", "~> 1.1.0"
29+
gem.add_development_dependency "rack-test", "~> 2"
3030
gem.add_development_dependency "rspec", "~> 3.1", ">= 3.1.0"
31-
gem.add_development_dependency "sinatra-contrib", ">= 2.0", "< 4.0"
31+
gem.add_development_dependency "sinatra-contrib", ">= 2.0", "< 5.0"
3232
gem.add_development_dependency "timecop", "~> 0.7", ">= 0.7.1"
3333
gem.add_development_dependency "pry"
3434
gem.add_development_dependency "pry-byebug"

0 commit comments

Comments
 (0)