Skip to content

[BUG] --- Ring request headers are as keywords, instead of downcased strings #3

Open
@viesti

Description

@viesti

First off, thanks for all the work in this area! I'm really happy about it :)

It seems that when this adapter is used together with the holy-lambda project, because the Lambda input JSON event is parsed as keys being keywordized, in the resulting ring request, the :headers is a map with keywords, instead of downcased strings, as in the Ring spec:

:headers
  (Required, clojure.lang.IPersistentMap)
  A Clojure map of downcased header name Strings to corresponding header value 
  Strings. When there are multiple headers with the same name, the header
  values are concatenated together, separated by the "," character.

Here's a sample prn of a Ring request from an app that I'm testing the library with:

{...
 :headers {:Authorization "eyJraW...",
           :Content-Type "application/json"},

I think this goes unnoticed in the tests, since the tests use a Ring request that has the :headers containing valid Ring spec data. I guess there could be a test in this library, that mocks a lambda runtime and uses holy-lambda proper, to make sure a valid ring request is produced, but before that, we probably could have a simpler test that gives the hander a request with say

{:headers {:Content-Type "..."}}

and makes sure that the adapter converts this into

{:headers {"content-type" "..."}}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions