parent
3243b8e0e0
commit
85fcbbee02
6 changed files with 53 additions and 10 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.cr text eol=lf
|
||||||
|
*.ecr text eol=lf
|
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
|
@ -11,31 +11,66 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
crystal: [latest, nightly]
|
crystal: [latest, nightly]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Crystal
|
- name: Install Crystal
|
||||||
uses: oprypin/install-crystal@v1
|
uses: crystal-lang/install-crystal@v1
|
||||||
with:
|
with:
|
||||||
crystal: ${{ matrix.crystal }}
|
crystal: ${{ matrix.crystal }}
|
||||||
|
|
||||||
- name: Download source
|
- name: Download source
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: shards install
|
run: shards install
|
||||||
env:
|
|
||||||
SHARDS_OPTS: --ignore-crystal-version
|
|
||||||
|
|
||||||
- name: Run specs
|
- name: Run specs
|
||||||
run: |
|
run: |
|
||||||
crystal spec
|
crystal spec
|
||||||
crystal spec --release --no-debug
|
|
||||||
|
format:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
crystal: [latest, nightly]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install Crystal
|
||||||
|
uses: crystal-lang/install-crystal@v1
|
||||||
|
with:
|
||||||
|
crystal: ${{ matrix.crystal }}
|
||||||
|
|
||||||
|
- name: Download source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: crystal tool format --check
|
run: crystal tool format --check
|
||||||
|
|
||||||
|
ameba:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
crystal: [latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install Crystal
|
||||||
|
uses: crystal-lang/install-crystal@v1
|
||||||
|
with:
|
||||||
|
crystal: ${{ matrix.crystal }}
|
||||||
|
|
||||||
|
- name: Download source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: shards install
|
||||||
|
|
||||||
- name: Run ameba linter
|
- name: Run ameba linter
|
||||||
run: bin/ameba
|
run: bin/ameba
|
||||||
|
|
|
@ -106,6 +106,7 @@ describe "Macros" do
|
||||||
request = HTTP::Request.new("GET", "/")
|
request = HTTP::Request.new("GET", "/")
|
||||||
response = call_request_on_app(request)
|
response = call_request_on_app(request)
|
||||||
response.status_code.should eq(200)
|
response.status_code.should eq(200)
|
||||||
|
|
||||||
response.headers["Content-Type"].should eq("application/octet-stream")
|
response.headers["Content-Type"].should eq("application/octet-stream")
|
||||||
response.headers["Content-Length"].should eq("18")
|
response.headers["Content-Length"].should eq("18")
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,8 +38,13 @@ describe "Run" do
|
||||||
Kemal.config.env = "test"
|
Kemal.config.env = "test"
|
||||||
Kemal.run do |config|
|
Kemal.run do |config|
|
||||||
server = config.server.not_nil!
|
server = config.server.not_nil!
|
||||||
server.bind_tcp "127.0.0.1", 3000, reuse_port: true
|
|
||||||
server.bind_tcp "0.0.0.0", 3001, reuse_port: true
|
{% if flag?(:windows) %}
|
||||||
|
server.bind_tcp "127.0.0.1", 3000
|
||||||
|
{% else %}
|
||||||
|
server.bind_tcp "127.0.0.1", 3000, reuse_port: true
|
||||||
|
server.bind_tcp "0.0.0.0", 3001, reuse_port: true
|
||||||
|
{% end %}
|
||||||
end
|
end
|
||||||
CR
|
CR
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Kemal
|
module Kemal
|
||||||
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
|
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
|
||||||
|
|
||||||
# Stores all the configuration options for a Kemal application.
|
# Stores all the configuration options for a Kemal application.
|
||||||
# It's a singleton and you can access it like.
|
# It's a singleton and you can access it like.
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Kemal
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
expanded_path = File.expand_path(request_path, "/")
|
expanded_path = request_path
|
||||||
is_dir_path = if original_path.ends_with?('/') && !expanded_path.ends_with? '/'
|
is_dir_path = if original_path.ends_with?('/') && !expanded_path.ends_with? '/'
|
||||||
expanded_path = expanded_path + '/'
|
expanded_path = expanded_path + '/'
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in a new issue