kemalcr/kemal-csrf

Tests fail on Crystal 1.0.0

hugopl opened this issue · 4 comments

Applying this patch on shards.yml to let it compile with Crystal 1.0.0 make some tests fail:

diff --git a/shard.yml b/shard.yml
index 71562b6..4186bcf 100644
--- a/shard.yml
+++ b/shard.yml
@@ -4,7 +4,7 @@ version: 0.7.0
 dependencies:
   kemal-session:
     github: kemalcr/kemal-session
-    version: 0.12.1
+    version: ~>1.0.0
 
 development_dependencies:
   kemal:
@@ -14,6 +14,6 @@ authors:
   - Serdar Dogruyol <dogruyolserdar@gmail.com>
 
 
-crystal: 0.35.0
+crystal: ">= 0.36.1, < 2.0.0"
 
 license: MIT

Crystal spec result:

Failures:

  1) CSRF allows POSTs with the correct token in FORM submit
     Failure/Error: client_response.status_code.should eq 404

       Expected: 404
            got: 403

     # spec/kemal-csrf_spec.cr:38

  2) CSRF allows POSTs with the correct token in HTTP header
     Failure/Error: client_response.status_code.should eq 404

       Expected: 404
            got: 403

     # spec/kemal-csrf_spec.cr:60

Finished in 3.19 milliseconds
9 examples, 2 failures, 0 errors, 0 pending

Failed examples:

crystal spec spec/kemal-csrf_spec.cr:20 # CSRF allows POSTs with the correct token in FORM submit
crystal spec spec/kemal-csrf_spec.cr:41 # CSRF allows POSTs with the correct token in HTTP header

With the same patch but using Crystal 0.36.1 all tests pass.

Been looking at this code, there isn't much but I can't figure it out.

Maybe related to this?

actually it's probably this

PR fix #30

Fixed by #30