summaryrefslogtreecommitdiff
path: root/content/2023/http-headers-in-rails-hyphens-and-underscores.md
diff options
context:
space:
mode:
authormms <michal@sapka.me>2023-12-05 11:57:10 +0100
committermms <michal@sapka.me>2023-12-05 11:57:10 +0100
commit4c17989711a76866214f71f645fdf8fe785c15ad (patch)
treef5d65084bacd3a6a3842ac512006c6da7b98fd1a /content/2023/http-headers-in-rails-hyphens-and-underscores.md
parentb2606034ed696e5acc95f0033d19e6b0bef142c7 (diff)
chore: extract old blog posts to section
Diffstat (limited to 'content/2023/http-headers-in-rails-hyphens-and-underscores.md')
-rw-r--r--content/2023/http-headers-in-rails-hyphens-and-underscores.md22
1 files changed, 0 insertions, 22 deletions
diff --git a/content/2023/http-headers-in-rails-hyphens-and-underscores.md b/content/2023/http-headers-in-rails-hyphens-and-underscores.md
deleted file mode 100644
index f872ebc..0000000
--- a/content/2023/http-headers-in-rails-hyphens-and-underscores.md
+++ /dev/null
@@ -1,22 +0,0 @@
----
-title: "HTTP Headers in Rails: Hyphens, Underscores, and a terrible day"
-category: engineering
-abstract: Rack modyfies incomming requests's headers!
-date: 2023-02-01T18:00:51+01:00
-year: 2023
-draft: false
-tags:
-- rack
-- Ruby-on-Rails
-- headers
-- magic
----
-Everyone's favorite magician, Ruby on Rails, does it again.
-
-As it turns out, [Rack modifies incoming requests' headers](https://github.com/rails/rails/blob/aaf7bed00338c3a97dbb12b3c82a30ae34e67876/actionpack/lib/action_dispatch/http/headers.rb#L12) and normalizes they keys. So, every time the client/proxy sends something cool like `A-HEADER`, the key is modified, so some characters become underscore. Therefore in Rails code need to access `A_HEADER`, and if I had known that yesterday, my day would be much more pleasant.
-
-> Also note that when headers are mapped to CGI-like variables by the Rack
->
-> server, both dashes and underscores are converted to underscores.
->
-> (as [per documentation](https://github.com/rails/rails/blob/aaf7bed00338c3a97dbb12b3c82a30ae34e67876/actionpack/lib/action_dispatch/http/headers.rb#L12)