From 22d6c1773ee74250ebef7dcffae1e22d5e9c48bd Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Wed, 29 Jun 2016 14:52:47 -0700 Subject: [PATCH] Remove HTTP prefix, this is a Rack impl convention, not a standard. --- spec/middleware/csrf_spec.cr | 2 +- src/kemal/middleware/csrf.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/middleware/csrf_spec.cr b/spec/middleware/csrf_spec.cr index 664eabb..c5e814a 100644 --- a/spec/middleware/csrf_spec.cr +++ b/spec/middleware/csrf_spec.cr @@ -55,7 +55,7 @@ describe "Kemal::Middleware::CSRF" do body: "hasan=lamec", headers: HTTP::Headers{"Content-Type" => "application/x-www-form-urlencoded", "Set-Cookie" => client_response.headers["Set-Cookie"], - "http-x-csrf-token" => current_token }) + "x-csrf-token" => current_token }) io, context = process_request(handler, request) client_response = HTTP::Client::Response.from_io(io, decompress: false) client_response.status_code.should eq 404 diff --git a/src/kemal/middleware/csrf.cr b/src/kemal/middleware/csrf.cr index cc46c75..9ae841f 100644 --- a/src/kemal/middleware/csrf.cr +++ b/src/kemal/middleware/csrf.cr @@ -11,7 +11,7 @@ module Kemal::Middleware # where an attacker can re-submit a form. # class CSRF < HTTP::Handler - HEADER = "HTTP_X_CSRF_TOKEN" + HEADER = "X_CSRF_TOKEN" ALLOWED_METHODS = %w[GET HEAD OPTIONS TRACE] PARAMETER_NAME = "authenticity_token"