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:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
crystal: [latest, nightly]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Install Crystal
|
||||
uses: oprypin/install-crystal@v1
|
||||
uses: crystal-lang/install-crystal@v1
|
||||
with:
|
||||
crystal: ${{ matrix.crystal }}
|
||||
|
||||
- name: Download source
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: shards install
|
||||
env:
|
||||
SHARDS_OPTS: --ignore-crystal-version
|
||||
|
||||
- name: Run specs
|
||||
run: |
|
||||
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
|
||||
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
|
||||
run: bin/ameba
|
||||
|
|
@ -106,6 +106,7 @@ describe "Macros" do
|
|||
request = HTTP::Request.new("GET", "/")
|
||||
response = call_request_on_app(request)
|
||||
response.status_code.should eq(200)
|
||||
|
||||
response.headers["Content-Type"].should eq("application/octet-stream")
|
||||
response.headers["Content-Length"].should eq("18")
|
||||
end
|
||||
|
|
|
@ -38,8 +38,13 @@ describe "Run" do
|
|||
Kemal.config.env = "test"
|
||||
Kemal.run do |config|
|
||||
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
|
||||
CR
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Kemal
|
||||
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
|
||||
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
|
||||
|
||||
# Stores all the configuration options for a Kemal application.
|
||||
# It's a singleton and you can access it like.
|
||||
|
|
|
@ -27,7 +27,7 @@ module Kemal
|
|||
return
|
||||
end
|
||||
|
||||
expanded_path = File.expand_path(request_path, "/")
|
||||
expanded_path = request_path
|
||||
is_dir_path = if original_path.ends_with?('/') && !expanded_path.ends_with? '/'
|
||||
expanded_path = expanded_path + '/'
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue