syntropy 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76abcde175da96ee8d1617b13d3fc02cb87b3f825adb63a7ed272cdb03c7663a
4
- data.tar.gz: 46735e1a209c90bd1c9bcea7c81b02e93bee5b21a57502ed63032eb559d2e9d7
3
+ metadata.gz: 3b742120d066c6f610604b187792715c1ef969684719f435a6b3a01c2b3c8995
4
+ data.tar.gz: 700c6ca989e8535014236e2923c19a6215c0f4f4114e67f050d43a132d2b2a23
5
5
  SHA512:
6
- metadata.gz: 35ba5001a3cefc35fb50361ec781613bbe3c4c282ebcb4cccfdf3bc86053fe0d40b4effe9b87a4045a9cab80702baf861de3f32b199216a78d2d323bd30c06c8
7
- data.tar.gz: f8f5a47a1abd7adf7463121e282c51c30a7adf47c7141a0d0d72baaf225996d78a8fbb3a8597f2d0a1dc876eeb63f2857214b5a16361ce8a41da7c298ee75871
6
+ metadata.gz: 11a35c917205ebaa26a8d628c7c35e03e05c82432ca45d3d0cabe1c27233044e1827ebba2a054c5f9d16c4812decfc93e82ec6477bc825638e0a0658a2d6e58f
7
+ data.tar.gz: b8c3c63e074d1d2cf4b66466c160ee70175c31f5f69ca625e1e5caabd5b41c5dc2169c426db35ef7d1ce77a545dfa45a575795501d1abbfa37a8936def913b6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.3 2025-07-06
2
+
3
+ - Correctly handle HEAD requests for template modules
4
+
1
5
  ## 0.8.2 2025-07-06
2
6
 
3
7
  - Update deps
data/TODO.md CHANGED
@@ -1,3 +1,7 @@
1
+ - Test HEAD requests for:
2
+ - markdown
3
+ - static files
4
+
1
5
  - Some standard middleware:
2
6
 
3
7
  - request rewriter
data/lib/syntropy/app.rb CHANGED
@@ -143,10 +143,13 @@ module Syntropy
143
143
  :invalid
144
144
  end
145
145
 
146
- def wrap_template(templ)
146
+ def wrap_template(template)
147
147
  lambda { |req|
148
- body = templ.render
149
- req.respond(body, 'Content-Type' => 'text/html')
148
+ headers = { 'Content-Type' => template.mime_type }
149
+ req.respond_by_http_method(
150
+ 'head' => [nil, headers],
151
+ 'get' => -> { [template.render, headers] }
152
+ )
150
153
  }
151
154
  end
152
155
 
@@ -45,8 +45,9 @@ module Syntropy
45
45
  when nil
46
46
  raise 'No export found'
47
47
  when Symbol
48
+ o = mod_ctx.new(@env)
48
49
  # TODO: verify export_value denotes a valid method
49
- mod_ctx.new(@env)
50
+ ->(req) { o.send(export_value, req) }
50
51
  when String
51
52
  ->(req) { req.respond(export_value) }
52
53
  when Proc
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Syntropy
4
- VERSION = '0.8.2'
4
+ VERSION = '0.8.3'
5
5
  end
data/test/test_app.rb CHANGED
@@ -121,6 +121,9 @@ class AppTest < Minitest::Test
121
121
  req = make_request(':method' => 'GET', ':path' => '/test/about/foo')
122
122
  assert_equal '<p>Hello from Markdown</p>', req.response_body.chomp
123
123
 
124
+ req = make_request(':method' => 'HEAD', ':path' => '/test/about/foo')
125
+ assert_nil req.response_body
126
+
124
127
  req = make_request(':method' => 'GET', ':path' => '/test/about/foo/bar')
125
128
  assert_equal Status::NOT_FOUND, req.response_status
126
129
  end
data/test/test_module.rb CHANGED
@@ -19,10 +19,9 @@ class ModuleTest < Minitest::Test
19
19
  assert_raises(RuntimeError) { @loader.load('_lib/missing-export') }
20
20
 
21
21
  mod = @loader.load('_lib/callable')
22
- assert_kind_of Syntropy::Module, mod
22
+ assert_kind_of Proc, mod
23
23
  assert_equal 'barbarbar', mod.call(3)
24
24
  assert_raises(NoMethodError) { mod.foo(2) }
25
- assert_equal 42, mod.bar
26
25
 
27
26
  mod = @loader.load('_lib/klass')
28
27
  assert_equal :bar, mod.foo
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntropy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner